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 or Collections#emptyMap() otherwise.
    default java.util.Map<java.lang.String,​java.lang.String> getAttributes​(java.lang.String selector)
    Gets attributes of the node or Collections#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 or Collections#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 element
    default 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 element
    default Point getClickablePoint​(java.lang.String selector)  
    default Point getClickablePoint​(java.lang.String selector, java.lang.Object... args)  
    default java.lang.String getDOMSnapshot()
    Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents).
    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 element
    default Session setAttribute​(java.lang.String selector, java.lang.String name, java.lang.Object value)
    Sets attribute for an element
    default Session setAttribute​(java.lang.String selector, java.lang.String name, java.lang.Object value, java.lang.Object... args)
    Sets attribute for an element
    default 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 selector
      args - 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

      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.
      Parameters:
      selector - css or xpath selector
      Returns:
      this
    • selectInputText

      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.
      Parameters:
      selector - css or xpath selector
      args - format string
      Returns:
      this
    • focus

      default Session focus​(java.lang.String selector)
      The HTMLElement.focus() method sets focus on the specified element, if it can be focused.
      Parameters:
      selector - css or xpath selector
      Returns:
      this
    • focus

      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.
      Parameters:
      selector - css or xpath selector
      contextId - 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 selector
      args - format string
      contextId - 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 selector
      args - format string
      Returns:
      selected index of the first <option> element.
    • setSelectedIndex

      default Session setSelectedIndex​(java.lang.String selector, int index)
      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. Use setSelectedOptions(String, List) method if the multiple attribute is specified for a <select> element.
      Parameters:
      selector - css or xpath selector
      index - he index of the first selected <option> element.
      Returns:
      this
    • setSelectedIndex

      default Session setSelectedIndex​(java.lang.String selector, int index, java.lang.Object... args)
      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. Use setSelectedOptions(String, List, Object...) method if the multiple attribute is specified for a <select> element.
      Parameters:
      selector - css or xpath selector
      index - he index of the first selected <option> element.
      Returns:
      this
    • getOptions

      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.
      Parameters:
      selector - css or xpath selector
      Returns:
      list of HTML <option> elements (in document order).
    • getOptions

      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.
      Parameters:
      selector - css or xpath selector
      args - format string
      Returns:
      list of HTML <option> elements (in document order).
    • clearOptions

      default Session clearOptions​(java.lang.String selector)
      Clears any existing selected items of <select> element.
      Parameters:
      selector - css or xpath selector
      Returns:
      this
    • clearOptions

      default Session clearOptions​(java.lang.String selector, java.lang.Object... args)
      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 selector
      indexes - 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 selector
      indexes - indices of selected items.
      args - format string
      Returns:
      this
    • setFiles

      default Session setFiles​(java.lang.String selector, java.nio.file.Path... files)
      Sets files for the given file input element.
      Parameters:
      selector - css or xpath selector
      files - list of file paths to set
      Returns:
      this
    • setFiles

      default Session setFiles​(java.lang.String selector, java.lang.String... files)
      Sets files for the given file input element.
      Parameters:
      selector - css or xpath selector
      files - 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 selector
      args - 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 selector
      args - format string
      Returns:
      true if radio or checkbox is selected
    • setChecked

      default Session setChecked​(java.lang.String selector, boolean checked)
      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 selector
      checked - the new checked state
      Returns:
      this
    • setChecked

      default Session setChecked​(java.lang.String selector, boolean checked, java.lang.Object... args)
      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 selector
      checked - the new checked state
      args - format string
      Returns:
      this
    • setDisabled

      default Session setDisabled​(java.lang.String selector, boolean disabled)
      Sets the value of the disabled property.
      Parameters:
      selector - css or xpath selector
      disabled - the new disabled state
      Returns:
      this
    • setDisabled

      default Session setDisabled​(java.lang.String selector, boolean disabled, java.lang.Object... args)
      Sets the value of the disabled property.
      Parameters:
      selector - css or xpath selector
      disabled - the new disabled state
      args - format string
      Returns:
      this
    • setValue

      default Session setValue​(java.lang.String selector, java.lang.Object value)
      Sets the value of the <input> input control.
      Parameters:
      selector - css or xpath selector
      value - 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 selector
      value - the new value
      args - 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 selector
      args - 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 or Collections#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 or Collections#emptyMap() otherwise.
      Parameters:
      selector - css or xpath selector
      args - 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 or Collections#emptyMap() otherwise.
      Parameters:
      selector - css or xpath selector
      args - format string
      contextId - 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 selector
      name - 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 selector
      name - the name of the attribute to retrieve
      args - 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 selector
      name - the name of the attribute to retrieve
      args - 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 selector
      name - the name of the attribute to create or alter
      value - value to set in string form
      args - 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 selector
      name - the name of the attribute to create or alter
      value - value to set in string form
      args - 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 selector
      name - the name of the attribute to create or alter
      value - value to set in string form
      Returns:
      this
    • getBoxModel

      default 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 element
      Parameters:
      selector - css or xpath selector
      args - 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 selector
      args - 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 selector
      args - 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

      default Point getClickablePoint​(java.lang.String selector)
    • getClickablePoint

      default Point getClickablePoint​(java.lang.String selector, java.lang.Object... args)
    • getDOMSnapshot

      default java.lang.String getDOMSnapshot()
      Returns a document snapshot, including the full DOM tree of the root node (including iframes, template contents, and imported documents).
    • getThis

      Session getThis()