Package io.webfolder.cdp.session
Interface Dom
- All Known Implementing Classes:
Session
public interface Dom
Provides the interfaces for the Document Object Model (DOM).
-
Method Summary
Modifier and TypeMethodDescriptiondefault Session
clearOptions
(String selector) Clears any existing selected items of <select> element.default Session
clearOptions
(String selector, Object... args) Clears any existing selected items of <select> element.default Session
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.default Session
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.default Session
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.default Session
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.default String
getAttribute
(Integer contextId, String selector, String name, Object... args) Retrieves an attribute value by name.default String
getAttribute
(String selector, String name) Retrieves an attribute value by name.default String
getAttribute
(String selector, String name, Object... args) Retrieves an attribute value by name.getAttributes
(Integer contextId, String selector, Object... args) Gets attributes of the node orCollections.emptyMap()
otherwise.getAttributes
(String selector) Gets attributes of the node orCollections.emptyMap()
otherwise.getAttributes
(String selector, Object... args) Gets attributes of the node orCollections.emptyMap()
otherwise.default BoxModel
getBoxModel
(Integer contextId, String selector, Object... args) Gets box model of an element Box model hold the height, width and coordinate of the elementdefault BoxModel
getBoxModel
(String selector, Object... args) Gets box model of an element Box model hold the height, width and coordinate of the elementdefault Point
getClickablePoint
(String selector) default Point
getClickablePoint
(String selector, Object... args) default Point
getClickablePointWithObjectId
(String selector, String objectId, Object... args) default List<DocumentSnapshot>
Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents).default String
Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents).default String
getInnerHtml
(String selector) Returnselement.innerHTML
.default String
getInnerHtml
(String selector, Object... args) Returnselement.innerHTML
.getOptions
(String selector) The list of options for a <select> element consists of all the option element children of the select element, and all the <option> element children of all the <optgroup> element children of the <select> element.getOptions
(String selector, Object... args) The list of options for a <select> element consists of all the option element children of the select element, and all the <option> element children of all the <optgroup> element children of the <select> element.default String
getOuterHtml
(String selector) Returns node's HTML markup.default String
getOuterHtml
(String selector, Object... args) Returns node's HTML markup.default int
getSelectedIndex
(String selector) The HTMLSelectElement.selectedIndex() is a int that reflects the index of the first selected <option> element.default int
getSelectedIndex
(String selector, Object... args) The HTMLSelectElement.selectedIndex() is a int that reflects the index of the first selected <option> element.default String
textContent property represents the text content of a node and its descendants.default String
textContent property represents the text content of a node and its descendants.getThis()
default String
Gets the value of the <input> control.default String
Gets the value of the <input> control.default boolean
Indicates whether the <input> element is checked or not.default boolean
Indicates whether the <input> element is checked or not.default boolean
isDisabled
(String selector) Indicates whether the <input> element is disabled or not.default boolean
isDisabled
(String selector, Object... args) Indicates whether the <input> element is disabled or not.default void
scrollIntoViewIfNeeded
(String selector) Scrolls the the given node into view if not already visible.default void
scrollIntoViewIfNeeded
(String selector, Object... args) Scrolls the the given node into view if not already visible.default void
scrollIntoViewIfNeededWithObjectId
(String selector, String objectId, Object... args) Scrolls the the given node into view if not already visible.default Session
selectInputText
(String selector) The HTMLInputElement.select() method selects all the text in a <textarea> element
or an <input> element with a text field.default Session
selectInputText
(String selector, Object... args) The HTMLInputElement.select() method selects all the text in a <textarea> element
or an <input> element with a text field.default Session
Sets attribute for an elementdefault Session
setAttribute
(String selector, String name, Object value) Sets attribute for an elementdefault Session
setAttribute
(String selector, String name, Object value, Object... args) Sets attribute for an elementdefault Session
setChecked
(String selector, boolean checked) Sets the value of the checked property.default Session
setChecked
(String selector, boolean checked, Object... args) Sets the value of the checked property.default Session
setDisabled
(String selector, boolean disabled) Sets the value of the disabled property.default Session
setDisabled
(String selector, boolean disabled, Object... args) Sets the value of the disabled property.default Session
Sets files for the given file input element.default Session
Sets files for the given file input element.default Session
setSelectedIndex
(String selector, int index) Set selectedIndex of <option> element.default Session
setSelectedIndex
(String selector, int index, Object... args) Set selectedIndex of <option> element.default Session
setSelectedOptions
(String selector, List<Integer> indexes) Set selected indices of <select> element.default Session
setSelectedOptions
(String selector, List<Integer> indexes, Object... args) Set selected indices of <select> element.default Session
Sets the value of the <input> input control.default Session
Sets the value of the <input> control.
-
Method Details
-
getText
textContent property represents the text content of a node and its descendants. textContent returns null if the element is a document, a document type, or a notation. To grab all of the text and CDATA data for the whole document, one could use document.documentElement.textContent.- Parameters:
selector
- css or xpath selector- Returns:
- textContent returns the concatenation of the textContent property value of every child node,
excluding comments and processing instruction nodes. This is an empty string if the node has no children.
-
getText
textContent property represents the text content of a node and its descendants. textContent returns null if the element is a document, a document type, or a notation. To grab all of the text and CDATA data for the whole document, one could use document.documentElement.textContent.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
- textContent returns the concatenation of the textContent property value of every child node,
excluding comments and processing instruction nodes. This is an empty string if the node has no children.
-
selectInputText
The HTMLInputElement.select() method selects all the text in a <textarea> element
or an <input> element with a text field.- Parameters:
selector
- css or xpath selector- Returns:
- this
-
selectInputText
The HTMLInputElement.select() method selects all the text in a <textarea> element
or an <input> element with a text field.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
- this
-
focus
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.- Parameters:
selector
- css or xpath selector- Returns:
- this
-
focus
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
- this
-
focus
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.- Parameters:
selector
- css or xpath selectorcontextId
- Context id of the frame- Returns:
- this
-
focus
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.- Parameters:
selector
- css or xpath selectorargs
- format stringcontextId
- Context id of the frame- Returns:
- this
-
getSelectedIndex
The HTMLSelectElement.selectedIndex() is a int that reflects the index of the first selected <option> element. The selectedIndex property returns -1 if a select object does not contain any selected items.- Parameters:
selector
- css or xpath selector- Returns:
- selected index of the first <option> element.
-
getSelectedIndex
The HTMLSelectElement.selectedIndex() is a int that reflects the index of the first selected <option> element. The selectedIndex property returns -1 if a select object does not contain any selected items.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
- selected index of the first <option> element.
-
setSelectedIndex
Set selectedIndex of <option> element. When you set the selectedIndex property, the display of the select object updates immediately. This method most useful when used with select objects that support selecting only one item at a time. UsesetSelectedOptions(String, List)
method if the multiple attribute is specified for a <select> element.- Parameters:
selector
- css or xpath selectorindex
- he index of the first selected <option> element.- Returns:
- this
-
setSelectedIndex
Set selectedIndex of <option> element. When you set the selectedIndex property, the display of the select object updates immediately. This method is most useful when used with select objects that support selecting only one item at a time. UsesetSelectedOptions(String, List, Object...)
method if the multiple attribute is specified for a <select> element.- Parameters:
selector
- css or xpath selectorindex
- he index of the first selected <option> element.- Returns:
- this
-
getOptions
The list of options for a <select> element consists of all the option element children of the select element, and all the <option> element children of all the <optgroup> element children of the <select> element.- Parameters:
selector
- css or xpath selector- Returns:
- list of HTML <option> elements (in document order).
-
getOptions
The list of options for a <select> element consists of all the option element children of the select element, and all the <option> element children of all the <optgroup> element children of the <select> element.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
- list of HTML <option> elements (in document order).
-
clearOptions
Clears any existing selected items of <select> element.- Parameters:
selector
- css or xpath selector- Returns:
- this
-
clearOptions
Clears any existing selected items of <select> element.- Parameters:
selector
- css or xpath selector- Returns:
- this
-
setSelectedOptions
Set selected indices of <select> element.- Parameters:
selector
- css or xpath selectorindexes
- indices of selected items.- Returns:
- this
-
setSelectedOptions
Set selected indices of <select> element.- Parameters:
selector
- css or xpath selectorindexes
- indices of selected items.args
- format string- Returns:
- this
-
setFiles
Sets files for the given file input element.- Parameters:
selector
- css or xpath selectorfiles
- list of file paths to set- Returns:
- this
-
setFiles
Sets files for the given file input element.- Parameters:
selector
- css or xpath selectorfiles
- list of file paths to set- Returns:
- this
-
isDisabled
Indicates whether the <input> element is disabled or not.- Parameters:
selector
- css or xpath selector- Returns:
true
if <input> element is disabled
-
isDisabled
Indicates whether the <input> element is disabled or not.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
true
if <input> element is disabled
-
isChecked
Indicates whether the <input> element is checked or not. This method is useful for only radio and checkbox element.- Parameters:
selector
- css or xpath selector- Returns:
true
if radio or checkbox is selected
-
isChecked
Indicates whether the <input> element is checked or not. This method is useful for only radio and checkbox element.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
true
if radio or checkbox is selected
-
setChecked
Sets the value of the checked property. type attribute must be set to checkbox or radio for this method to have any effect.- Parameters:
selector
- css or xpath selectorchecked
- the new checked state- Returns:
- this
-
setChecked
Sets the value of the checked property. type attribute must be set to checkbox or radio for this method to have any effect.- Parameters:
selector
- css or xpath selectorchecked
- the new checked stateargs
- format string- Returns:
- this
-
setDisabled
Sets the value of the disabled property.- Parameters:
selector
- css or xpath selectordisabled
- the new disabled state- Returns:
- this
-
setDisabled
Sets the value of the disabled property.- Parameters:
selector
- css or xpath selectordisabled
- the new disabled stateargs
- format string- Returns:
- this
-
setValue
Sets the value of the <input> input control.- Parameters:
selector
- css or xpath selectorvalue
- the new value- Returns:
- this
-
setValue
Sets the value of the <input> control.- Parameters:
selector
- css or xpath selectorvalue
- the new valueargs
- format string- Returns:
- this
-
getValue
Gets the value of the <input> control.- Parameters:
selector
- css or xpath selector- Returns:
- value of <input> control
-
getValue
Gets the value of the <input> control.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
- value of <input> control
-
getAttributes
Gets attributes of the node orCollections.emptyMap()
otherwise.- Parameters:
selector
- css or xpath selector- Returns:
- returns all attribute nodes registered to the specified node.
-
getAttributes
Gets attributes of the node orCollections.emptyMap()
otherwise.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
- returns all attribute nodes registered to the specified node.
-
getAttributes
Gets attributes of the node orCollections.emptyMap()
otherwise.- Parameters:
selector
- css or xpath selectorargs
- format stringcontextId
- Frame context id- Returns:
- returns all attribute nodes registered to the specified node.
-
getAttribute
Retrieves an attribute value by name.- Parameters:
selector
- css or xpath selectorname
- the name of the attribute to retrieve- Returns:
- the value of attribute or
null
if there is no such attribute.
-
getAttribute
Retrieves an attribute value by name.- Parameters:
selector
- css or xpath selectorname
- the name of the attribute to retrieveargs
- format string- Returns:
- the value of attribute or
null
if there is no such attribute.
-
getAttribute
Retrieves an attribute value by name.- Parameters:
selector
- css or xpath selectorname
- the name of the attribute to retrieveargs
- format string- Returns:
- the value of attribute or
null
if there is no such attribute.
-
setAttribute
Sets attribute for an element- Parameters:
selector
- css or xpath selectorname
- the name of the attribute to create or altervalue
- value to set in string formargs
- format string- Returns:
- this
-
setAttribute
default Session setAttribute(Integer contextId, String selector, String name, Object value, Object... args) Sets attribute for an element- Parameters:
selector
- css or xpath selectorname
- the name of the attribute to create or altervalue
- value to set in string formargs
- format string- Returns:
- this
-
setAttribute
Sets attribute for an element- Parameters:
selector
- css or xpath selectorname
- the name of the attribute to create or altervalue
- value to set in string form- Returns:
- this
-
getBoxModel
Gets box model of an element Box model hold the height, width and coordinate of the element- Parameters:
selector
- css or xpath selectorargs
- fromat string- Returns:
- Box model of element or
null
otherwise
-
getBoxModel
Gets box model of an element Box model hold the height, width and coordinate of the element- Parameters:
selector
- css or xpath selectorargs
- fromat string- Returns:
- Box model of element or
null
otherwise
-
getOuterHtml
Returns node's HTML markup.- Parameters:
selector
- css or xpath selector- Returns:
- Outer HTML markup.
-
getOuterHtml
Returns node's HTML markup.- Parameters:
selector
- css or xpath selectorargs
- fromat string- Returns:
- Outer HTML markup.
-
getInnerHtml
Returnselement.innerHTML
.- Parameters:
selector
- css or xpath selector- Returns:
- innerHTML markup.
-
getInnerHtml
Returnselement.innerHTML
.- Parameters:
selector
- css or xpath selectorargs
- fromat string- Returns:
- innerHTML markup.
-
scrollIntoViewIfNeeded
Scrolls the the given node into view if not already visible. -
scrollIntoViewIfNeeded
Scrolls the the given node into view if not already visible. -
scrollIntoViewIfNeededWithObjectId
Scrolls the the given node into view if not already visible. -
getClickablePoint
-
getClickablePoint
-
getClickablePointWithObjectId
-
getDocumentSnapshot
Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents). Faster than {getDOMSnapshot()
} consumes less memory and cpu -
getDOMSnapshot
Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents). -
getThis
Session getThis()
-