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 Type Method Description default Session
clearOptions(java.lang.String selector)
Clears any existing selected items of <select> element.default Session
clearOptions(java.lang.String selector, java.lang.Object... args)
Clears any existing selected items of <select> element.default Session
focus(java.lang.Integer contextId, java.lang.String selector)
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.default Session
focus(java.lang.Integer contextId, java.lang.String selector, java.lang.Object... args)
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.default Session
focus(java.lang.String selector)
The HTMLElement.focus() method sets focus on the specified element, if it can be focused.default java.lang.String
getAttribute(java.lang.Integer contextId, java.lang.String selector, java.lang.String name, java.lang.Object... args)
Retrieves an attribute value by name.default java.lang.String
getAttribute(java.lang.String selector, java.lang.String name)
Retrieves an attribute value by name.default java.lang.String
getAttribute(java.lang.String selector, java.lang.String name, java.lang.Object... args)
Retrieves an attribute value by name.default java.util.Map<java.lang.String,java.lang.String>
getAttributes(java.lang.Integer contextId, java.lang.String selector, java.lang.Object... args)
Gets attributes of the node orCollections.emptyMap()
otherwise.default java.util.Map<java.lang.String,java.lang.String>
getAttributes(java.lang.String selector)
Gets attributes of the node orCollections.emptyMap()
otherwise.default java.util.Map<java.lang.String,java.lang.String>
getAttributes(java.lang.String selector, java.lang.Object... args)
Gets attributes of the node orCollections.emptyMap()
otherwise.default BoxModel
getBoxModel(java.lang.Integer contextId, java.lang.String selector, java.lang.Object... args)
Gets box model of an element Box model hold the height, width and coordinate of the elementdefault BoxModel
getBoxModel(java.lang.String selector, java.lang.Object... args)
Gets box model of an element Box model hold the height, width and coordinate of the elementdefault Point
getClickablePoint(java.lang.String selector)
default Point
getClickablePoint(java.lang.String selector, java.lang.Object... args)
default java.util.List<Option>
getOptions(java.lang.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.default java.util.List<Option>
getOptions(java.lang.String selector, java.lang.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 java.lang.String
getOuterHtml(java.lang.String selector)
Returns node's HTML markup.default java.lang.String
getOuterHtml(java.lang.String selector, java.lang.Object... args)
Returns node's HTML markup.default int
getSelectedIndex(java.lang.String selector)
The HTMLSelectElement.selectedIndex() is a int that reflects the index of the first selected <option> element.default int
getSelectedIndex(java.lang.String selector, java.lang.Object... args)
The HTMLSelectElement.selectedIndex() is a int that reflects the index of the first selected <option> element.default java.lang.String
getText(java.lang.String selector)
textContent property represents the text content of a node and its descendants.default java.lang.String
getText(java.lang.String selector, java.lang.Object... args)
textContent property represents the text content of a node and its descendants.Session
getThis()
default java.lang.String
getValue(java.lang.String selector)
Gets the value of the <input> control.default java.lang.String
getValue(java.lang.String selector, java.lang.Object... args)
Gets the value of the <input> control.default boolean
isChecked(java.lang.String selector)
Indicates whether the <input> element is checked or not.default boolean
isChecked(java.lang.String selector, java.lang.Object... args)
Indicates whether the <input> element is checked or not.default boolean
isDisabled(java.lang.String selector)
Indicates whether the <input> element is disabled or not.default boolean
isDisabled(java.lang.String selector, java.lang.Object... args)
Indicates whether the <input> element is disabled or not.default void
scrollIntoViewIfNeeded(java.lang.String selector)
default void
scrollIntoViewIfNeeded(java.lang.String selector, java.lang.Object... args)
default Session
selectInputText(java.lang.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(java.lang.String selector, java.lang.Object... args)
The HTMLInputElement.select() method selects all the text in a <textarea> element
or an <input> element with a text field.default Session
setAttribute(java.lang.Integer contextId, java.lang.String selector, java.lang.String name, java.lang.Object value, java.lang.Object... args)
Sets attribute for an elementdefault Session
setAttribute(java.lang.String selector, java.lang.String name, java.lang.Object value)
Sets attribute for an elementdefault Session
setAttribute(java.lang.String selector, java.lang.String name, java.lang.Object value, java.lang.Object... args)
Sets attribute for an elementdefault Session
setChecked(java.lang.String selector, boolean checked)
Sets the value of the checked property.default Session
setChecked(java.lang.String selector, boolean checked, java.lang.Object... args)
Sets the value of the checked property.default Session
setDisabled(java.lang.String selector, boolean disabled)
Sets the value of the disabled property.default Session
setDisabled(java.lang.String selector, boolean disabled, java.lang.Object... args)
Sets the value of the disabled property.default Session
setFiles(java.lang.String selector, java.lang.String... files)
Sets files for the given file input element.default Session
setFiles(java.lang.String selector, java.nio.file.Path... files)
Sets files for the given file input element.default Session
setSelectedIndex(java.lang.String selector, int index)
Set selectedIndex of <option> element.default Session
setSelectedIndex(java.lang.String selector, int index, java.lang.Object... args)
Set selectedIndex of <option> element.default Session
setSelectedOptions(java.lang.String selector, java.util.List<java.lang.Integer> indexes)
Set selected indices of <select> element.default Session
setSelectedOptions(java.lang.String selector, java.util.List<java.lang.Integer> indexes, java.lang.Object... args)
Set selected indices of <select> element.default Session
setValue(java.lang.String selector, java.lang.Object value)
Sets the value of the <input> input control.default Session
setValue(java.lang.String selector, java.lang.Object value, java.lang.Object... args)
Sets the value of the <input> control.
-
Method Details
-
getText
default java.lang.String getText(java.lang.String selector)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
default java.lang.String getText(java.lang.String selector, java.lang.Object... args)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 selectorselector
- 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 selectorcontextId
- Context id of the frame- Returns:
- this
-
focus
default Session focus(java.lang.Integer contextId, java.lang.String selector, java.lang.Object... args)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
default int getSelectedIndex(java.lang.String selector)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
default int getSelectedIndex(java.lang.String selector, java.lang.Object... args)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:
css
- 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:
css
- 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
default Session setSelectedOptions(java.lang.String selector, java.util.List<java.lang.Integer> indexes)Set selected indices of <select> element.- Parameters:
selector
- css or xpath selectorindexes
- indices of selected items.- Returns:
- this
-
setSelectedOptions
default Session setSelectedOptions(java.lang.String selector, java.util.List<java.lang.Integer> indexes, java.lang.Object... args)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
default boolean isDisabled(java.lang.String selector)Indicates whether the <input> element is disabled or not.- Parameters:
selector
- css or xpath selector- Returns:
true
if <input> element is disabled
-
isDisabled
default boolean isDisabled(java.lang.String selector, java.lang.Object... args)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
default boolean isChecked(java.lang.String selector)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
default boolean isChecked(java.lang.String selector, java.lang.Object... args)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
default Session setValue(java.lang.String selector, java.lang.Object value, java.lang.Object... args)Sets the value of the <input> control.- Parameters:
selector
- css or xpath selectorvalue
- the new valueargs
- format string- Returns:
- this
-
getValue
default java.lang.String getValue(java.lang.String selector)Gets the value of the <input> control.- Parameters:
selector
- css or xpath selector- Returns:
- value of <input> control
-
getValue
default java.lang.String getValue(java.lang.String selector, java.lang.Object... args)Gets the value of the <input> control.- Parameters:
selector
- css or xpath selectorargs
- format string- Returns:
- value of <input> control
-
getAttributes
default java.util.Map<java.lang.String,java.lang.String> getAttributes(java.lang.String selector)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
default java.util.Map<java.lang.String,java.lang.String> getAttributes(java.lang.String selector, java.lang.Object... args)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
default java.util.Map<java.lang.String,java.lang.String> getAttributes(java.lang.Integer contextId, java.lang.String selector, java.lang.Object... args)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
default java.lang.String getAttribute(java.lang.String selector, java.lang.String name)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
default java.lang.String getAttribute(java.lang.String selector, java.lang.String name, java.lang.Object... args)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
default java.lang.String getAttribute(java.lang.Integer contextId, java.lang.String selector, java.lang.String name, java.lang.Object... args)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
default Session setAttribute(java.lang.String selector, java.lang.String name, java.lang.Object value, java.lang.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
default Session setAttribute(java.lang.Integer contextId, java.lang.String selector, java.lang.String name, java.lang.Object value, java.lang.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
default Session setAttribute(java.lang.String selector, java.lang.String name, java.lang.Object value)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
default BoxModel getBoxModel(java.lang.Integer contextId, java.lang.String selector, java.lang.Object... args)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
default java.lang.String getOuterHtml(java.lang.String selector)Returns node's HTML markup.- Parameters:
selector
- css or xpath selector- Returns:
- Outer HTML markup.
-
getOuterHtml
default java.lang.String getOuterHtml(java.lang.String selector, java.lang.Object... args)Returns node's HTML markup.- Parameters:
selector
- css or xpath selectorargs
- fromat string- Returns:
- Outer HTML markup.
-
scrollIntoViewIfNeeded
default void scrollIntoViewIfNeeded(java.lang.String selector) -
scrollIntoViewIfNeeded
default void scrollIntoViewIfNeeded(java.lang.String selector, java.lang.Object... args) -
getClickablePoint
-
getClickablePoint
-
getThis
Session getThis()
-