public abstract class HtmlElement extends DomElement
Modifier and Type | Class and Description |
---|---|
static class |
HtmlElement.DisplayStyle
Enum for the different display styles.
|
DomElement.ChildElementsIterator
DomNode.ChildIterator, DomNode.DescendantElementsIterator<T extends DomNode>
Modifier and Type | Field and Description |
---|---|
static Short |
TAB_INDEX_OUT_OF_BOUNDS
Constant indicating that a tab index value is out of bounds (less than 0 or greater
than 32767).
|
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY
AS_TEXT_BLANK, AS_TEXT_BLOCK_SEPARATOR, AS_TEXT_NEW_LINE, AS_TEXT_TAB, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
Modifier | Constructor and Description |
---|---|
protected |
HtmlElement(String qualifiedName,
SgmlPage page,
Map<String,DomAttr> attributes)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addHtmlAttributeChangeListener(HtmlAttributeChangeListener listener)
Adds an HtmlAttributeChangeListener to the listener list.
|
HtmlElement |
appendChildIfNoneExists(String tagName)
Appends a child element to this HTML element with the specified tag name
if this HTML element does not already have a child with that tag name.
|
void |
blur()
Removes focus from this element.
|
protected void |
checkChildHierarchy(Node childNode)
Check for insertion errors for a new child node.
|
<P extends Page> |
click()
Simulates clicking on this element, returning the page in the window that has the focus
after the element has been clicked.
|
<P extends Page> |
click(boolean shiftKey,
boolean ctrlKey,
boolean altKey)
Simulates clicking on this element, returning the page in the window that has the focus
after the element has been clicked.
|
<P extends Page> |
click(Event event)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Simulates clicking on this element, returning the page in the window that has the focus after the element has been clicked. |
<P extends Page> |
dblClick()
Simulates double-clicking on this element, returning the page in the window that has the focus
after the element has been clicked.
|
<P extends Page> |
dblClick(boolean shiftKey,
boolean ctrlKey,
boolean altKey)
Simulates double-clicking on this element, returning the page in the window that has the focus
after the element has been clicked.
|
protected void |
doClickFireChangeEvent()
This method implements the control onchange handler call during the click action.
|
protected ScriptResult |
doClickFireClickEvent(Event event)
This method implements the control onclick handler call during the click action.
|
protected boolean |
doClickStateUpdate()
This method implements the control state update part of the click action.
|
protected void |
doType(char c,
boolean shiftKey,
boolean ctrlKey,
boolean altKey)
Performs the effective type action, called after the keyPress event and before the keyUp event.
|
ScriptResult |
fireEvent(Event event)
Fires the event on the element.
|
ScriptResult |
fireEvent(String eventType)
Shortcut for
fireEvent(Event) . |
protected void |
fireHtmlAttributeAdded(HtmlAttributeChangeEvent event)
Support for reporting HTML attribute changes.
|
protected void |
fireHtmlAttributeRemoved(HtmlAttributeChangeEvent event)
Support for reporting HTML attribute changes.
|
protected void |
fireHtmlAttributeReplaced(HtmlAttributeChangeEvent event)
Support for reporting HTML attribute changes.
|
void |
focus()
Sets the focus on this element.
|
String |
getCanonicalXPath()
Returns the canonical XPath expression which identifies this node, for instance
"/html/body/table[3]/tbody/tr[5]/td[2]/span/a[3]".
|
HtmlElement.DisplayStyle |
getDefaultStyleDisplay()
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Returns the default display style. |
<E extends HtmlElement> |
getElementsByAttribute(String elementName,
String attributeName,
String attributeValue)
Returns all elements which are descendants of this element and match the specified search criteria.
|
HtmlElement |
getEnclosingElement(String tagName)
Returns the first element with the specified tag name that is an ancestor to this element, or
null if no such element is found.
|
HtmlForm |
getEnclosingForm()
Returns the form which contains this element, or null if this element is not inside
of a form.
|
HtmlForm |
getEnclosingFormOrDie()
Returns the form which contains this element.
|
protected DomNode |
getEventTargetElement()
Returns the event target element.
|
<E extends HtmlElement> |
getHtmlElementsByTagName(String tagName)
Returns the HTML elements that are descendants of this element and that have the specified tag name.
|
List<HtmlElement> |
getHtmlElementsByTagNames(List<String> tagNames)
Returns the HTML elements that are descendants of this element and that have one of the specified tag names.
|
String |
getLangAttribute()
Returns the value of the attribute "lang".
|
String |
getNodeName()
Returns this node's node name.
|
String |
getOnClickAttribute()
Returns the value of the attribute "onclick".
|
String |
getOnDblClickAttribute()
Returns the value of the attribute "ondblclick".
|
<E extends HtmlElement> |
getOneHtmlElementByAttribute(String elementName,
String attributeName,
String attributeValue)
Searches for an element based on the specified criteria, returning the first element which matches
said criteria.
|
String |
getOnKeyDownAttribute()
Returns the value of the attribute "onkeydown".
|
String |
getOnKeyPressAttribute()
Returns the value of the attribute "onkeypress".
|
String |
getOnKeyUpAttribute()
Returns the value of the attribute "onkeyup".
|
String |
getOnMouseDownAttribute()
Returns the value of the attribute "onmousedown".
|
String |
getOnMouseMoveAttribute()
Returns the value of the attribute "onmousemove".
|
String |
getOnMouseOutAttribute()
Returns the value of the attribute "onmouseout".
|
String |
getOnMouseOverAttribute()
Returns the value of the attribute "onmouseover".
|
String |
getOnMouseUpAttribute()
Returns the value of the attribute "onmouseup".
|
protected String |
getSrcAttributeNormalized()
Helper for src retrieval and normalization.
|
Short |
getTabIndex()
Returns this element's tab index, if it has one.
|
String |
getTextDirectionAttribute()
Returns the value of the attribute "dir".
|
String |
getXmlLangAttribute()
Returns the value of the attribute "xml:lang".
|
boolean |
hasEventHandlers(String eventName)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Returns true if this element has any JavaScript functions that need to be executed when the specified event occurs. |
protected boolean |
isAttributeCaseSensitive()
Indicates if the attribute names are case sensitive.
|
boolean |
isDisplayed()
Returns true if this node is displayed and can be visible to the user
(ignoring screen size, scrolling limitations, color, font-size, or overlapping nodes).
|
protected boolean |
isStateUpdateFirst()
Returns true if state updates should be done before onclick event handling.
|
protected boolean |
isSubmittableByEnter()
Returns true if clicking Enter (ASCII 10, or '\n') should submit the enclosed form (if any).
|
Page |
mouseDown()
Simulates clicking the mouse on this element, returning the page which this element's window contains
after the mouse click.
|
Page |
mouseDown(boolean shiftKey,
boolean ctrlKey,
boolean altKey,
int button)
Simulates clicking the mouse on this element, returning the page which this element's window contains
after the mouse click.
|
Page |
mouseMove()
Simulates moving the mouse over this element, returning the page which this element's window contains
after the mouse move.
|
Page |
mouseMove(boolean shiftKey,
boolean ctrlKey,
boolean altKey,
int button)
Simulates moving the mouse over this element, returning the page which this element's window contains
after the mouse move.
|
Page |
mouseOut()
Simulates moving the mouse out of this element, returning the page which this element's window contains
after the mouse move.
|
Page |
mouseOut(boolean shiftKey,
boolean ctrlKey,
boolean altKey,
int button)
Simulates moving the mouse out of this element, returning the page which this element's window contains
after the mouse move.
|
Page |
mouseOver()
Simulates moving the mouse over this element, returning the page which this element's window contains
after the mouse move.
|
Page |
mouseOver(boolean shiftKey,
boolean ctrlKey,
boolean altKey,
int button)
Simulates moving the mouse over this element, returning the page which this element's window contains
after the mouse move.
|
Page |
mouseUp()
Simulates releasing the mouse click on this element, returning the page which this element's window contains
after the mouse click release.
|
Page |
mouseUp(boolean shiftKey,
boolean ctrlKey,
boolean altKey,
int button)
Simulates releasing the mouse click on this element, returning the page which this element's window contains
after the mouse click release.
|
protected void |
preventDefault()
This method is called if the current fired event is canceled by preventDefault() in FireFox,
or by returning false in Internet Explorer.
|
protected boolean |
propagateClickStateUpdateToParent() |
DomNode |
querySelector(String selectors)
Returns the first element within the document that matches the specified group of selectors.
|
DomNodeList<DomNode> |
querySelectorAll(String selectors)
Retrieves all element nodes from descendants of the starting element node that match any selector
within the supplied selector strings.
|
void |
removeAttribute(String attributeName)
Removes an attribute specified by name from this element.
|
void |
removeChild(String tagName,
int i)
Removes the ith child element with the specified tag name
from all relationships, if possible.
|
void |
removeEventHandler(String eventName)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Removes the specified event handler. |
void |
removeHtmlAttributeChangeListener(HtmlAttributeChangeListener listener)
Removes an HtmlAttributeChangeListener from the listener list.
|
Page |
rightClick()
Simulates right clicking the mouse on this element, returning the page which this element's window
contains after the mouse click.
|
Page |
rightClick(boolean shiftKey,
boolean ctrlKey,
boolean altKey)
Simulates right clicking the mouse on this element, returning the page which this element's window
contains after the mouse click.
|
Attr |
setAttributeNode(Attr attribute)
Sets the specified attribute.
|
void |
setAttributeNS(String namespaceURI,
String qualifiedName,
String attributeValue)
Sets the value of the specified attribute.
|
void |
setEventHandler(String eventName,
net.sourceforge.htmlunit.corejs.javascript.Function eventHandler)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Registers a JavaScript function as an event handler. |
void |
setEventHandler(String eventName,
String jsSnippet)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Register a snippet of JavaScript code as an event handler. |
void |
setId(String newId)
Sets the identifier this element.
|
String |
toString()
Returns a string representation of this object.
|
Page |
type(char c)
Simulates typing the specified character while this element has focus, returning the page contained
by this element's window after typing.
|
Page |
type(char c,
boolean shiftKey,
boolean ctrlKey,
boolean altKey)
Simulates typing the specified character while this element has focus, returning the page contained
by this element's window after typing.
|
Page |
type(int keyCode)
Simulates typing the specified key code while this element has focus, returning the page contained
by this element's window after typing.
|
Page |
type(int keyCode,
boolean shiftKey,
boolean ctrlKey,
boolean altKey)
Simulates typing the specified character while this element has focus, returning the page contained
by this element's window after typing.
|
void |
type(String text)
Simulates typing the specified text while this element has focus.
|
void |
type(String text,
boolean shiftKey,
boolean ctrlKey,
boolean altKey)
Simulates typing the specified text while this element has focus.
|
cloneNode, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getAttributesMap, getChildElementCount, getChildElements, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getId, getLastElementChild, getNextElementSibling, getNodeType, getPreviousElementSibling, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, hasAttributes, isEmptyXmlTagExpanded, namespaces, printOpeningTagContentAsXml, printXml, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNodeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, processImportNode, setPrefix
addDomChangeListener, appendChild, asText, asXml, compareDocumentPosition, detach, fireNodeAdded, fireNodeDeleted, getAncestors, getBaseURI, getByXPath, getByXPath, getChildNodes, getChildren, getDescendants, getEndColumnNumber, getEndLineNumber, getFeature, getFirstByXPath, getFirstByXPath, getFirstChild, getHtmlElementDescendants, getHtmlPageOrNull, getIndex, getLastChild, getNextSibling, getNodeValue, getOwnerDocument, getPage, getParentNode, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, getTextContent, getUserData, hasChildNodes, hasFeature, insertBefore, insertBefore, isAncestorOf, isAncestorOfAny, isBlock, isDefaultNamespace, isDescendant, isDirectlyAttachedToPage, isEqualNode, isSameNode, isSupported, isTrimmedText, lookupNamespaceURI, lookupPrefix, mayBeDisplayed, normalize, notifyIncorrectness, onAddedToDocumentFragment, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, remove, removeAllChildren, removeChild, removeDomChangeListener, replace, replaceChild, setNextSibling, setNodeValue, setParentNode, setPreviousSibling, setReadyState, setScriptObject, setTextContent, setUserData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
appendChild, compareDocumentPosition, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
public static final Short TAB_INDEX_OUT_OF_BOUNDS
getTabIndex()
protected HtmlElement(String qualifiedName, SgmlPage page, Map<String,DomAttr> attributes)
qualifiedName
- the qualified name of the element type to instantiatepage
- the page that contains this elementattributes
- a map ready initialized with the attributes for this element, or
null
. The map will be stored as is, not copied.public void setAttributeNS(String namespaceURI, String qualifiedName, String attributeValue)
setAttributeNS
in interface Element
setAttributeNS
in class DomElement
namespaceURI
- the URI that identifies an XML namespacequalifiedName
- the qualified name of the attributeattributeValue
- the value of the attributepublic Attr setAttributeNode(Attr attribute)
setAttributeNode
in interface Element
setAttributeNode
in class DomElement
attribute
- the attribute to setpublic final List<HtmlElement> getHtmlElementsByTagNames(List<String> tagNames)
tagNames
- the tag names to match (case-insensitive)public final <E extends HtmlElement> List<E> getHtmlElementsByTagName(String tagName)
E
- the sub-element typetagName
- the tag name to match (case-insensitive)public final void removeAttribute(String attributeName)
removeAttribute
in interface Element
removeAttribute
in class DomElement
attributeName
- the attribute attributeNameprotected void fireHtmlAttributeAdded(HtmlAttributeChangeEvent event)
HtmlAttributeChangeEvent
to any
registered HtmlAttributeChangeListener
s.
Note that this method recursively calls this element's parent's
fireHtmlAttributeAdded(HtmlAttributeChangeEvent)
method.event
- the eventaddHtmlAttributeChangeListener(HtmlAttributeChangeListener)
protected void fireHtmlAttributeReplaced(HtmlAttributeChangeEvent event)
HtmlAttributeChangeEvent
to any
registered HtmlAttributeChangeListener
s.
Note that this method recursively calls this element's parent's
fireHtmlAttributeReplaced(HtmlAttributeChangeEvent)
method.event
- the eventaddHtmlAttributeChangeListener(HtmlAttributeChangeListener)
protected void fireHtmlAttributeRemoved(HtmlAttributeChangeEvent event)
HtmlAttributeChangeEvent
to any
registered HtmlAttributeChangeListener
s.
Note that this method recursively calls this element's parent's
fireHtmlAttributeRemoved(HtmlAttributeChangeEvent)
method.event
- the eventaddHtmlAttributeChangeListener(HtmlAttributeChangeListener)
public String getNodeName()
DomElement
getNodeName
in interface Node
getNodeName
in class DomElement
DomElement.getTagName()
public final void setId(String newId)
newId
- the new identifier of this elementpublic Short getTabIndex()
TAB_INDEX_OUT_OF_BOUNDS
. If this element does not have
a tab index, or its tab index is otherwise invalid, this method returns null.public HtmlElement getEnclosingElement(String tagName)
tagName
- the name of the tag searched (case insensitive)public HtmlForm getEnclosingForm()
public HtmlForm getEnclosingFormOrDie() throws IllegalStateException
IllegalStateException
.IllegalStateException
- if the element is not inside a formpublic void type(String text) throws IOException
text
- the text you with to simulate typingIOException
- If an IO error occurspublic void type(String text, boolean shiftKey, boolean ctrlKey, boolean altKey) throws IOException
text
- the text you with to simulate typingshiftKey
- true if SHIFT is pressedctrlKey
- true if CTRL is pressedaltKey
- true if ALT is pressedIOException
- If an IO error occurspublic Page type(char c) throws IOException
c
- the character you wish to simulate typingIOException
- if an IO error occurspublic Page type(char c, boolean shiftKey, boolean ctrlKey, boolean altKey) throws IOException
c
- the character you wish to simulate typingshiftKey
- true if SHIFT is pressed during the typingctrlKey
- true if CTRL is pressed during the typingaltKey
- true if ALT is pressed during the typingWebClient.getCurrentWindow()
IOException
- if an IO error occurspublic Page type(int keyCode) throws IOException
KeyboardEvent.DOM_VK_PAGE_DOWN
.keyCode
- the key code wish to simulate typingIOException
- if an IO error occurspublic Page type(int keyCode, boolean shiftKey, boolean ctrlKey, boolean altKey) throws IOException
KeyboardEvent.DOM_VK_PAGE_DOWN
.keyCode
- the key code wish to simulate typingshiftKey
- true if SHIFT is pressed during the typingctrlKey
- true if CTRL is pressed during the typingaltKey
- true if ALT is pressed during the typingWebClient.getCurrentWindow()
IOException
- if an IO error occursprotected void doType(char c, boolean shiftKey, boolean ctrlKey, boolean altKey)
c
- the character you with to simulate typingshiftKey
- true if SHIFT is pressed during the typingctrlKey
- true if CTRL is pressed during the typingaltKey
- true if ALT is pressed during the typingprotected boolean isSubmittableByEnter()
public String toString()
public final <E extends HtmlElement> E getOneHtmlElementByAttribute(String elementName, String attributeName, String attributeValue) throws ElementNotFoundException
E
- the sub-element typeelementName
- the name of the element to search forattributeName
- the name of the attribute to search forattributeValue
- the value of the attribute to search forElementNotFoundException
- if no element matches the specified search criteriapublic final <E extends HtmlElement> List<E> getElementsByAttribute(String elementName, String attributeName, String attributeValue)
E
- the sub-element typeelementName
- the name of the element to search forattributeName
- the name of the attribute to search forattributeValue
- the value of the attribute to search forpublic final HtmlElement appendChildIfNoneExists(String tagName)
tagName
- the tag name of the child to appendpublic final void removeChild(String tagName, int i)
tagName
- the tag name of the child to removei
- the index of the child to removepublic final boolean hasEventHandlers(String eventName)
eventName
- the name of the event, such as "onclick" or "onblur", etcpublic final void setEventHandler(String eventName, net.sourceforge.htmlunit.corejs.javascript.Function eventHandler)
eventName
- the name of the event, such as "onclick" or "onblur", etceventHandler
- a Rhino JavaScript functionpublic final void setEventHandler(String eventName, String jsSnippet)
eventName
- Name of event such as "onclick" or "onblur", etcjsSnippet
- executable JavaScript codepublic final void removeEventHandler(String eventName)
eventName
- Name of the event such as "onclick" or "onblur", etcpublic void addHtmlAttributeChangeListener(HtmlAttributeChangeListener listener)
listener
- the attribute change listener to be addedremoveHtmlAttributeChangeListener(HtmlAttributeChangeListener)
public void removeHtmlAttributeChangeListener(HtmlAttributeChangeListener listener)
listener
- the attribute change listener to be removedaddHtmlAttributeChangeListener(HtmlAttributeChangeListener)
public ScriptResult fireEvent(String eventType)
fireEvent(Event)
.eventType
- the event type (like "load", "click")null
if nothing is executedpublic ScriptResult fireEvent(Event event)
event
- the event to fireprotected void preventDefault()
public Page mouseOver()
public Page mouseOver(boolean shiftKey, boolean ctrlKey, boolean altKey, int button)
shiftKey
- true if SHIFT is pressed during the mouse movectrlKey
- true if CTRL is pressed during the mouse movealtKey
- true if ALT is pressed during the mouse movebutton
- the button code, must be MouseEvent.BUTTON_LEFT
, MouseEvent.BUTTON_MIDDLE
or MouseEvent.BUTTON_RIGHT
public Page mouseMove()
public Page mouseMove(boolean shiftKey, boolean ctrlKey, boolean altKey, int button)
shiftKey
- true if SHIFT is pressed during the mouse movectrlKey
- true if CTRL is pressed during the mouse movealtKey
- true if ALT is pressed during the mouse movebutton
- the button code, must be MouseEvent.BUTTON_LEFT
, MouseEvent.BUTTON_MIDDLE
or MouseEvent.BUTTON_RIGHT
public Page mouseOut()
public Page mouseOut(boolean shiftKey, boolean ctrlKey, boolean altKey, int button)
shiftKey
- true if SHIFT is pressed during the mouse movectrlKey
- true if CTRL is pressed during the mouse movealtKey
- true if ALT is pressed during the mouse movebutton
- the button code, must be MouseEvent.BUTTON_LEFT
, MouseEvent.BUTTON_MIDDLE
or MouseEvent.BUTTON_RIGHT
public Page mouseDown()
public Page mouseDown(boolean shiftKey, boolean ctrlKey, boolean altKey, int button)
shiftKey
- true if SHIFT is pressed during the mouse clickctrlKey
- true if CTRL is pressed during the mouse clickaltKey
- true if ALT is pressed during the mouse clickbutton
- the button code, must be MouseEvent.BUTTON_LEFT
, MouseEvent.BUTTON_MIDDLE
or MouseEvent.BUTTON_RIGHT
public Page mouseUp()
public Page mouseUp(boolean shiftKey, boolean ctrlKey, boolean altKey, int button)
shiftKey
- true if SHIFT is pressed during the mouse click releasectrlKey
- true if CTRL is pressed during the mouse click releasealtKey
- true if ALT is pressed during the mouse click releasebutton
- the button code, must be MouseEvent.BUTTON_LEFT
, MouseEvent.BUTTON_MIDDLE
or MouseEvent.BUTTON_RIGHT
public Page rightClick()
public Page rightClick(boolean shiftKey, boolean ctrlKey, boolean altKey)
shiftKey
- true if SHIFT is pressed during the mouse clickctrlKey
- true if CTRL is pressed during the mouse clickaltKey
- true if ALT is pressed during the mouse clickpublic void blur()
public void focus()
protected void checkChildHierarchy(Node childNode) throws DOMException
checkChildHierarchy
in class DomNode
childNode
- the new child node that is being inserted below this nodeDOMException
- HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does
not allow children of the type of the newChild node, or if the node to insert is one of
this node's ancestors or this node itself, or if this node is of type Document and the
DOM application attempts to insert a second DocumentType or Element node.
WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the
one that created this node.protected boolean isAttributeCaseSensitive()
isAttributeCaseSensitive
in class DomElement
false
public <P extends Page> P click() throws IOException
P
- the page typeWebClient.getCurrentWindow()
IOException
- if an IO error occurspublic <P extends Page> P click(boolean shiftKey, boolean ctrlKey, boolean altKey) throws IOException
P
- the page typeshiftKey
- true if SHIFT is pressed during the clickctrlKey
- true if CTRL is pressed during the clickaltKey
- true if ALT is pressed during the clickWebClient.getCurrentWindow()
IOException
- if an IO error occursprotected DomNode getEventTargetElement()
public <P extends Page> P click(Event event) throws IOException
P
- the page typeevent
- the click event usedWebClient.getCurrentWindow()
IOException
- if an IO error occursprotected boolean doClickStateUpdate() throws IOException
The default implementation only calls doClickStateUpdate on parent's HtmlElement (if any).
Subclasses requiring different behavior (like HtmlSubmitInput
) will override this method.
IOException
- if an IO error occursprotected boolean propagateClickStateUpdateToParent()
Usually the click is propagated to the parent. Overwrite if you
like to disable this.
protected void doClickFireChangeEvent() throws IOException
IOException
- if an IO error occursprotected ScriptResult doClickFireClickEvent(Event event) throws IOException
event
- the click event usedIOException
- if an IO error occurspublic <P extends Page> P dblClick() throws IOException
click()
is automatically called first.P
- the page typeIOException
- if an IO error occurspublic <P extends Page> P dblClick(boolean shiftKey, boolean ctrlKey, boolean altKey) throws IOException
click(boolean, boolean, boolean)
is automatically
called first.P
- the page typeshiftKey
- true if SHIFT is pressed during the double-clickctrlKey
- true if CTRL is pressed during the double-clickaltKey
- true if ALT is pressed during the double-clickIOException
- if an IO error occurspublic final String getLangAttribute()
public final String getXmlLangAttribute()
public final String getTextDirectionAttribute()
public final String getOnClickAttribute()
public final String getOnDblClickAttribute()
public final String getOnMouseDownAttribute()
public final String getOnMouseUpAttribute()
public final String getOnMouseOverAttribute()
public final String getOnMouseMoveAttribute()
public final String getOnMouseOutAttribute()
public final String getOnKeyPressAttribute()
public final String getOnKeyDownAttribute()
public final String getOnKeyUpAttribute()
protected boolean isStateUpdateFirst()
HtmlCheckBoxInput
.public String getCanonicalXPath()
Returns the canonical XPath expression which identifies this node, for instance "/html/body/table[3]/tbody/tr[5]/td[2]/span/a[3]".
WARNING: This sort of automated XPath expression is often quite bad at identifying a node, as it is highly sensitive to changes in the DOM tree.
getCanonicalXPath
in class DomNode
DomNode.getByXPath(String)
public DomNodeList<DomNode> querySelectorAll(String selectors)
querySelectorAll
in class DomNode
selectors
- one or more CSS selectors separated by commaspublic DomNode querySelector(String selectors)
querySelector
in class DomNode
selectors
- one or more CSS selectors separated by commaspublic boolean isDisplayed()
Returns true if this node is displayed and can be visible to the user (ignoring screen size, scrolling limitations, color, font-size, or overlapping nodes).
NOTE: If CSS is
disabled
, this method
does not take this element's style into consideration!
isDisplayed
in class DomNode
DomNode.mayBeDisplayed()
public HtmlElement.DisplayStyle getDefaultStyleDisplay()
protected final String getSrcAttributeNormalized()
Copyright © 2002–2016 Gargoyle Software Inc.. All rights reserved.