The DomNode class

The DomNode class is derived from Node and also resides in the package de.qfs.apps.qftest.client.web.dom. In addition to the methods defined in the Node class and explained above, DomNode provides the following:

 
 
Object callJS(String code)
Execute some JavaScript code in a function in the context of this node's document. This often works even if the call of eval() is restricted by a Content Security Policy (CSP).
Parameters
codeThe script to execute. Use _qf_node as the reference for the HTML element.
ReturnsWhatever the code returns explicitely using a return statement, converted to the proper object type. Even returning a DOM node, frame or document works.
 
Object evalJS(String script)
Evaluate some JavaScript code in the context of this node's document by calling window.eval(). In most cases, the method callJS should be use, since the call of eval() might be restricted for the document by a Content Security Policy (CSP).
Parameters
scriptThe script to execute. Use _qf_node as the reference for the HTML element.
ReturnsWhatever the script returns, converted to the proper object type. Even returning a DOM node, frame or document works.
 
DomNode[] getAllByCSS(String css)
Get all nodes, which are determined via CSS-selectors.
Parameters
cssCSS-selector starting from that node.
ReturnsAn array of all found nodes or null.
 
DomNode[] getAllByXPath(String xpath)
Get all nodes, which are determined via XPath.
Parameters
xpathXPath starting from that node.
ReturnsAn array of all found nodes or null.
 
DomNode getByCSS(String css)
Get a node, which is determined via a CSS-selector.
Parameters
cssCSS-selector starting from that node.
ReturnsThe found node or null.
 
DomNode getByXPath(String xpath)
Get a node, which is determined via XPath.
Parameters
xpathXPath starting from that node.
ReturnsThe found node or null.
 
Node[] getChildrenByTagName(String tagName)
Get all direct child nodes of this node with a given tag name.
Parameters
tagNameThe tag name to look for.
Returns An array of child nodes with the given tag name. If none are found, an empty array is returned.
 
String getId()
Get the cached ID of the node which may have been processed by an IdResolver as described in subsection 53.1.17. The original, unmodified 'ID' attribute is available via getAttribute("id").
ReturnsThe cached ID of the node.
 
int[] getLocationOnScreen()
Get the location and size of the node relative to desktop.
ReturnsThe node's geometry in the form [x, y, width, height].
 
boolean hasCSSClass(String cl)
Check, whether the node has a specified css-class.
Parameters
clThe name of the css-class.
ReturnsTrue, if the node has this css-class, otherwise false.
 
boolean hasFocus()
Test whether the node has the keyboard focus.
Returns True if the node has the keyboard focus.
 
boolean isShowing()
Test whether the node is visible or can be made visible by scrolling.
Returns True if the node is visible.
 
void requestFocus()
Tell the node to request the keyboard focus. This is a best-effort implementation. Whether the node actually receives the keyboard focus depends on the browser and operating system settings.
 
void scrollVisible()
Try to scroll the page or a frame so as to make the node fully visible. This is a best effort implementation. Whether the node can actually be made visible depends on the browser and operating system settings.
 
void setAttribute(String name, String value)
Set an attribute value on the node.
Parameters
nameThe name of the attribute.
valueThe value to set.
 
void toJS(String name)
Set a JavaScript variable in the context of this node's document to this node.
Parameters
nameThe name of the variable to set.