Class MobileElement<T>

  • Direct Known Subclasses:
    MobileButton, MobileLabel, MobileLink, MobileTextBox

    public class MobileElement<T>
    extends UiElement
    An Mobile element. Can be identified by:
    • id
    • name
    • text - the exact text that element displays
    • partialText - some part of the text that element displays
    • xpath

    • Method Detail

      • getAttributeValue

        public String getAttributeValue​(String attribute)
        Get element attribute value
        Returns:
        value of the attribute (style/class/...). Note: Currently for WebView elements seems to be returning something only if such HTML attribute is explicitly set.
      • getTextContent

        public String getTextContent()
        Get innerText of the element
        Returns:
        innerText of the element
      • click

        public T click()
        Simulate tap/click action
        Returns:
        this mobile element so allows chained actions like element.click().getTextContent()
      • clickIfExists

        public boolean clickIfExists​(int waitingTimeout)
        Click/tap the element if exists.
        Parameters:
        waitingTimeout - timeout in milliseconds to wait for the element to appear
      • scrollTo

        public T scrollTo()
        Scroll to element (at the center of the screen)
        Returns:
        this mobile element which allows chained actions