Package com.meterware.httpunit
Class BlockElement
java.lang.Object
com.meterware.httpunit.ParsedHTML
com.meterware.httpunit.BlockElement
- All Implemented Interfaces:
HTMLElement
,HTMLSegment
,ScriptingEventHandler
Represents a block-level element such as a paragraph or table cell, which can contain other elements.
- Since:
- 1.6
- Author:
- Russell Gold
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BlockElement
(WebResponse response, FrameSelector frame, URL baseURL, String baseTarget, Node rootNode, String characterSet) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Deprecated.since 1.7 - use doEventScript insteadboolean
doEventScript
(String eventScript) optional do the event if it's definedboolean
getAttribute
(String name) get the attribute with the given nameprotected int
getAttributeValue
(Node node, String attributeName, int defaultValue) Returns the class attribute associated with this element.getDOM()
Returns a copy of the domain object model associated with this HTML segment.getID()
Returns the ID associated with this element.getName()
Returns the name associated with this element.getNode()
Returns the DOM node underlying this element.Returns the scriptable delegate which can provide the scriptable delegate for this element.Returns the delegate which supports scripting this element.Returns the tag for this block.getText()
Returns the text value of this block.getTitle()
Returns the title associated with this element.boolean
handleEvent
(String eventName) handle the event with the given name by getting the attribute and then executing the eventScript for itint
hashCode()
boolean
isSupportedAttribute
(String name) Returns true if this element may have an attribute with the specified name.void
removeAttribute
(String name) remove the attribute with the given namevoid
setAttribute
(String name, Object value) set the attribute with the given name to the given valueMethods inherited from class com.meterware.httpunit.ParsedHTML
getApplets, getElementNames, getElementsWithAttribute, getElementsWithName, getElementWithID, getFirstMatchingForm, getFirstMatchingLink, getFirstMatchingTable, getFirstMatchingTextBlock, getForms, getFormWithID, getFormWithName, getFrames, getImages, getImageWithAltText, getImageWithName, getImageWithSource, getLinks, getLinkWith, getLinkWithID, getLinkWithImageText, getLinkWithName, getMatchingForms, getMatchingLinks, getMatchingTables, getNextTextBlock, getTables, getTableStartingWith, getTableStartingWithPrefix, getTableWithID, getTableWithSummary, getTextBlocks, isWebLink, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.meterware.httpunit.HTMLSegment
getApplets, getElementNames, getElementsWithAttribute, getElementsWithName, getElementWithID, getFirstMatchingForm, getFirstMatchingLink, getFirstMatchingTable, getForms, getFormWithID, getFormWithName, getImages, getImageWithAltText, getImageWithName, getImageWithSource, getLinks, getLinkWith, getLinkWithImageText, getMatchingForms, getMatchingLinks, getMatchingTables, getTables, getTableStartingWith, getTableStartingWithPrefix, getTableWithID, getTableWithSummary, getTextBlocks
-
Constructor Details
-
BlockElement
protected BlockElement(WebResponse response, FrameSelector frame, URL baseURL, String baseTarget, Node rootNode, String characterSet)
-
-
Method Details
-
getText
Returns the text value of this block.- Specified by:
getText
in interfaceHTMLElement
-
getTagName
Returns the tag for this block.- Specified by:
getTagName
in interfaceHTMLElement
-
getDOM
Returns a copy of the domain object model associated with this HTML segment.- Overrides:
getDOM
in classParsedHTML
-
getID
Returns the ID associated with this element. IDs are unique throughout the HTML document.- Specified by:
getID
in interfaceHTMLElement
-
getClassName
Returns the class attribute associated with this element.- Specified by:
getClassName
in interfaceHTMLElement
-
getName
Returns the name associated with this element.- Specified by:
getName
in interfaceHTMLElement
-
getTitle
Returns the title associated with this element.- Specified by:
getTitle
in interfaceHTMLElement
-
getScriptingHandler
Returns the delegate which supports scripting this element.- Specified by:
getScriptingHandler
in interfaceHTMLElement
-
doEvent
Deprecated.since 1.7 - use doEventScript insteadhandle the event that has the given script attached by compiling the eventScript as a function and executing it- Specified by:
doEvent
in interfaceScriptingEventHandler
- Parameters:
eventScript
- - the script to use- Returns:
- true if the script is empty or the result of the script
-
doEventScript
optional do the event if it's defined- Specified by:
doEventScript
in interfaceScriptingEventHandler
- Parameters:
eventScript
- - the script to work on- Returns:
- true if the event script was handled
-
handleEvent
Description copied from interface:ScriptingEventHandler
handle the event with the given name by getting the attribute and then executing the eventScript for it- Specified by:
handleEvent
in interfaceScriptingEventHandler
- Returns:
- the result of doEventScript
-
getParentDelegate
Description copied from interface:HTMLElement
Returns the scriptable delegate which can provide the scriptable delegate for this element.- Specified by:
getParentDelegate
in interfaceHTMLElement
-
newScriptable
- Specified by:
newScriptable
in interfaceHTMLElement
-
getAttribute
get the attribute with the given name- Specified by:
getAttribute
in interfaceHTMLElement
- Parameters:
name
- - the name of the attribute to get
-
setAttribute
set the attribute with the given name to the given value- Specified by:
setAttribute
in interfaceHTMLElement
- Parameters:
name
- - the name of the attribute to setvalue
- - the value to use
-
removeAttribute
remove the attribute with the given name- Specified by:
removeAttribute
in interfaceHTMLElement
- Parameters:
name
- - the name of the attribute
-
isSupportedAttribute
Returns true if this element may have an attribute with the specified name.- Specified by:
isSupportedAttribute
in interfaceHTMLElement
-
getNode
Description copied from interface:HTMLElement
Returns the DOM node underlying this element.- Specified by:
getNode
in interfaceHTMLElement
-
equals
-
hashCode
public int hashCode() -
getAttributeValue
-