Class HtmlElement

  • Direct Known Subclasses:
    HiddenHtmlElement, RealHtmlElement

    public abstract class HtmlElement
    extends UiElement
    Used to represent generic HTML element (tag). It could be used to work with generic elements like span, div, etc. Such elements could be located by any HTML attribute including custom ones.

    Special cases:

    • use _text attribute for finding elements by certain text (in-between tags)
    • use _partText attribute for finding elements by partial match of text in-between tags
    • use _inputType attribute for locating elements by their type attribute. _inputType is replaced with type HTML attribute when generating element''s XPath

    • Method Detail

      • getAttributeValue

        public abstract String getAttributeValue​(String attribute)
        Get element attribute value
        Returns:
        value of the attribute (style/class/...)
      • getCssPropertyValue

        public abstract String getCssPropertyValue​(String propertyName)
        Get CSS property value
        Parameters:
        propertyName - CSS property name
        Returns:
        the value of the target CSS property
      • getTextContent

        public abstract String getTextContent()
        Get text content of the element
        Returns:
        text content of the element
      • setTextContent

        public abstract void setTextContent​(String content)
        Set the content of the element
        Parameters:
        content - the new content
      • click

        public abstract void click()
        Simulate mouse click action
      • doubleClick

        public abstract void doubleClick()
        Simulate mouse double click action
      • rightClick

        public abstract void rightClick()
        Simulate mouse right click action
      • mouseOver

        public abstract void mouseOver()
        Simulate mouse over
      • pressEnterKey

        public abstract void pressEnterKey()
        Simulate Enter key
      • pressSpaceKey

        public abstract void pressSpaceKey()
        Simulate Space key
      • pressTabKey

        public abstract void pressTabKey()
        Simulate Tab key
      • pressEscapeKey

        public abstract void pressEscapeKey()
        Simulate Escape key
      • dragAndDropTo

        public abstract void dragAndDropTo​(HtmlElement targetElement)
        Drag and drop an element on top of other element
        Parameters:
        targetElement - the target element