Interface Dom

All Known Implementing Classes:
Session

public interface Dom
Provides the interfaces for the Document Object Model (DOM).
  • Method Details

    • getText

      default String getText(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 String getText(String selector, 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(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(String selector, 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(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(String selector, 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
      Returns:
      this
    • focus

      default Session focus(Integer contextId, 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(Integer contextId, String selector, 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(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(String selector, 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(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(String selector, int index, 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 List<Option> 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.
      Parameters:
      selector - css or xpath selector
      Returns:
      list of HTML <option> elements (in document order).
    • getOptions

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

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

      default Session clearOptions(String selector, Object... args)
      Clears any existing selected items of <select> element.
      Parameters:
      selector - css or xpath selector
      Returns:
      this
    • setSelectedOptions

      default Session setSelectedOptions(String selector, List<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(String selector, List<Integer> indexes, 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(String selector, 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(String selector, 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(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(String selector, 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(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(String selector, 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(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(String selector, boolean checked, 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(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(String selector, boolean disabled, 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(String selector, 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(String selector, Object value, 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 String getValue(String selector)
      Gets the value of the <input> control.
      Parameters:
      selector - css or xpath selector
      Returns:
      value of <input> control
    • getValue

      default String getValue(String selector, 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 Map<String,String> getAttributes(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 Map<String,String> getAttributes(String selector, 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 Map<String,String> getAttributes(Integer contextId, String selector, 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 String getAttribute(String selector, 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 String getAttribute(String selector, String name, 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 String getAttribute(Integer contextId, String selector, String name, 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(String selector, String name, Object value, 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(Integer contextId, String selector, String name, Object value, 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(String selector, String name, 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(String selector, 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(Integer contextId, String selector, 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 String getOuterHtml(String selector)
      Returns node's HTML markup.
      Parameters:
      selector - css or xpath selector
      Returns:
      Outer HTML markup.
    • getOuterHtml

      default String getOuterHtml(String selector, Object... args)
      Returns node's HTML markup.
      Parameters:
      selector - css or xpath selector
      args - fromat string
      Returns:
      Outer HTML markup.
    • getInnerHtml

      default String getInnerHtml(String selector)
      Returns element.innerHTML.
      Parameters:
      selector - css or xpath selector
      Returns:
      innerHTML markup.
    • getInnerHtml

      default String getInnerHtml(String selector, Object... args)
      Returns element.innerHTML.
      Parameters:
      selector - css or xpath selector
      args - fromat string
      Returns:
      innerHTML markup.
    • scrollIntoViewIfNeeded

      default void scrollIntoViewIfNeeded(String selector)
      Scrolls the the given node into view if not already visible.
    • scrollIntoViewIfNeeded

      default void scrollIntoViewIfNeeded(String selector, Object... args)
      Scrolls the the given node into view if not already visible.
    • scrollIntoViewIfNeededWithObjectId

      default void scrollIntoViewIfNeededWithObjectId(String selector, String objectId, Object... args)
      Scrolls the the given node into view if not already visible.
    • getClickablePoint

      default Point getClickablePoint(String selector)
    • getClickablePoint

      default Point getClickablePoint(String selector, Object... args)
    • getClickablePointWithObjectId

      default Point getClickablePointWithObjectId(String selector, String objectId, Object... args)
    • getDocumentSnapshot

      default List<DocumentSnapshot> 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

      default 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()