Class DOMObjectValidator

    • Constructor Detail

      • DOMObjectValidator

        public DOMObjectValidator​(SmartAppDriver appDriver,
                                  DOMObject domObject,
                                  org.sikuli.script.Region region)
    • Method Detail

      • getAttributeValue

        public String getAttributeValue​(String attributeName,
                                        int maxIterationsToLocateElements)
        Returns the attribute value of the first element.
        Parameters:
        attributeName -
        maxIterationsToLocateElements -
        Returns:
      • getAttributeValueWhenElementVisible

        public String getAttributeValueWhenElementVisible​(String attributeName,
                                                          int maxIterationsToLocateElements)
        Finds attribute value from element when it is not hidden.
        Parameters:
        maxIterationsToLocateElements -
      • getAttributeValueWhenAttributeValueNonEmpty

        public String getAttributeValueWhenAttributeValueNonEmpty​(String attributeName,
                                                                  int maxIterationsToLocateElements)
        Finds attribute value from visible element when it's value is not empty. Leading and trailing whitespace will be removed in comparision.
        Parameters:
        maxIterationsToLocateElements -
      • findElement

        public org.openqa.selenium.WebElement findElement​(int maxIterationsToLocateElements)
        Finds first element with polling and it polls after 2 seconds for maxIterationsToLocateElements times.
        Specified by:
        findElement in class UIObjectValidator
        Parameters:
        maxIterationsToLocateElements -
        Returns:
      • waitForPageLoad

        public void waitForPageLoad()
      • findElementNoException

        public org.openqa.selenium.WebElement findElementNoException​(int maxIterationsToLocateElements)
        Finds first element with polling and it polls after 2 seconds for maxIterationsToLocateElements times. It does not throw any exception
        Specified by:
        findElementNoException in class UIObjectValidator
        Parameters:
        maxIterationsToLocateElements -
        Returns:
      • findElements

        public List<org.openqa.selenium.WebElement> findElements​(int maxIterationsToLocateElements)
        This returns all the elements based on the locator. It waits for the configured timeout if the element is not present. Performs polling maxIterationsToLocateElements times.
        Specified by:
        findElements in class UIObjectValidator
        Parameters:
        maxIterationsToLocateElements -
        Returns:
      • isPresent

        public boolean isPresent​(int maxIterationsToLocateElements)
        Return true only if first element is present but it might not be visible.
        Specified by:
        isPresent in class UIObjectValidator
        Parameters:
        maxIterationsToLocateElements -
        Returns:
      • isVisible

        public boolean isVisible​(int maxIterationsToLocateElements)
        Return true only if element is visible.
        Specified by:
        isVisible in class UIObjectValidator
        Parameters:
        maxIterationsToLocateElements -
        Returns:
      • isReadonly

        public boolean isReadonly​(int maxIterationsToLocateElements)
      • isDisabled

        public boolean isDisabled​(int maxIterationsToLocateElements)
      • isDisabledButNotReadonly

        public boolean isDisabledButNotReadonly​(int maxIterationsToLocateElements)
      • isSelected

        public boolean isSelected​(int maxIterationsToLocateElements)
        Determine whether or not this element is selected or not. This operation only applies to input elements such as checkboxes, options in a select and radio buttons.
        Returns:
        True if the element is currently selected or checked, false otherwise.
      • getText

        public String getText​(int maxIterationsToLocateElements)
        Finds text from element when element is present in HTML.
        Parameters:
        maxIterationsToLocateElements -
      • getTextWhenElementVisible

        public String getTextWhenElementVisible​(int maxIterationsToLocateElements)
        Finds text from element when it is not hidden.
        Parameters:
        maxIterationsToLocateElements -
      • getTextWhenElementValueNonEmpty

        public String getTextWhenElementValueNonEmpty​(int maxIterationsToLocateElements)
        Finds text from visible element when it's value is not empty. Leading and trailing whitespace will be removed.
        Parameters:
        maxIterationsToLocateElements -
      • validatePresentWithNonEmptyText

        public DOMObjectValidator validatePresentWithNonEmptyText​(int maxIterationsToLocateElements)
        Validates whether the element is visible with non-empty text on screen.
        Parameters:
        maxIterationsToLocateElements -
      • copyTextToClipboard

        public DOMObjectValidator copyTextToClipboard​(int maxIterationsToLocateElements)
        Copy text into clipboard from the current cursor position. Applicable only for editable fields i.e textbox, textarea etc. First it will click on that element and then select all text and copy into clipboard.
        Returns:
      • pasteTextFromClipboard

        public DOMObjectValidator pasteTextFromClipboard​(int maxIterationsToLocateElements)
        Replace the content of the element with the clipboard contents. Applicable only for editable fields i.e textbox, textarea etc.
        Returns:
      • typeText

        public DOMObjectValidator typeText​(String text,
                                           NewTextLocation location,
                                           int typeSpeedInMspc,
                                           boolean clickBeforeType,
                                           int maxIterationsToLocateElements)
        Used to type the text on textbox and textarea componenets.
        Parameters:
        text - - text to type
        location - - location where to start typing.
        typeSpeedInMspc - - type speed in milliseconds per character.
        clickBeforeType - - should click before typing.
        maxIterationsToLocateElements - - max iteration to locate elements.
        Returns:
      • typeWithInterval

        public void typeWithInterval​(String textToType,
                                     int typeSpeedInMspc,
                                     org.openqa.selenium.WebElement webElem)