Class Waits


  • public final class Waits
    extends Object
    Handle all kinds of waits for web ,ios ,android elements to appear on the DOM before continue
    Since:
    1.9.6
    Author:
    David Yehezkel
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.openqa.selenium.Alert alertIsPresent​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By by)
      wait for alert to be on page
      static boolean attributeContains​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, String attribute, String value)
      An expectation for checking WebElement with given locator has attribute which contains specific value
      static boolean attributeContains​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element, String attribute, String value)
      An expectation for checking WebElement with given locator has attribute which contains specific value
      static boolean attributeToBe​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, String attribute, String value)
      An expectation for checking WebElement with given locator has attribute with a specific value
      static boolean attributeToBe​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element, String attribute, String value)
      An expectation for checking given WebElement has attribute with a specific value
      static boolean attributeToBeNotEmpty​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element, String attribute)
      An expectation for checking WebElement any non empty value for given attribute
      static boolean containsText​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By by, String textToBeContains)  
      static boolean elementSelectionStateToBe​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By by, boolean selected)
      Determine whether or not this element is selected or not.
      static boolean elementSelectionStateToBe​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element, boolean selected)
      Determine whether or not this element is selected or not.
      static org.openqa.selenium.WebElement elementToBeClickable​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator)
      An expectation for checking an element is visible and enabled such that you can click it.
      static org.openqa.selenium.WebElement elementToBeClickable​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element)
      An expectation for checking an element is visible and enabled such that you can click it.
      static boolean elementToBeSelected​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator)
      An expectation for checking if the given element is selected.
      static boolean elementToBeSelected​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element)
      An expectation for checking if the given element is selected.
      static org.openqa.selenium.WebDriver frameToBeAvailableAndSwitchToIt​(org.openqa.selenium.WebDriver driver, int timeOut, int frameLocator)
      An expectation for checking whether the given frame is available to switch to.
      static org.openqa.selenium.WebDriver frameToBeAvailableAndSwitchToIt​(org.openqa.selenium.WebDriver driver, int timeOut, String frameLocator)
      An expectation for checking whether the given frame is available to switch to.
      static org.openqa.selenium.WebDriver frameToBeAvailableAndSwitchToIt​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator)
      An expectation for checking whether the given frame is available to switch to.
      static org.openqa.selenium.WebDriver frameToBeAvailableAndSwitchToIt​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement frameLocator)
      An expectation for checking whether the given frame is available to switch to.
      static boolean invisibilityOf​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element)
      An expectation for checking the element to be invisible
      static boolean invisibilityOfAllElements​(org.openqa.selenium.WebDriver driver, int timeOut, List<org.openqa.selenium.WebElement> elements)
      An expectation for checking all elements from given list to be invisible
      static boolean invisibilityOfAllElements​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement... elements)
      An expectation for checking all elements from given list to be invisible
      static boolean invisibilityOfElementLocated​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator)
      An expectation for checking that an element is either invisible or not present on the DOM.
      static boolean invisibilityOfElementWithText​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, String text)
      An expectation for checking that an element with text is either invisible or not present on the DOM.
      static void milliseconds​(int milliseconds)
      wait by millisecond
      static List<org.openqa.selenium.WebElement> numberOfElementsToBe​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, int number)
      An expectation for checking number of WebElements with given locator
      static List<org.openqa.selenium.WebElement> numberOfElementsToBeLessThan​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, int number)
      An expectation for checking number of WebElements with given locator being less than defined number
      static List<org.openqa.selenium.WebElement> numberOfElementsToBeMoreThan​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, int number)
      An expectation for checking number of WebElements with given locator being more than defined number
      static boolean numberOfWindowsToBe​(org.openqa.selenium.WebDriver driver, int timeOut, int expectedNumberOfWindows)
      An expectation for checking number of window with given by expectedNumberOfWindows
      static void numberOfWindowsToBeAndSwitchTo​(org.openqa.selenium.WebDriver driver, int timeOut, int expectedNumberOfWindows, int switchToWindowNumber)
      waits for number of window to be user expected number of windows and switch to user window number
      static void pageToFullyLoad​(org.openqa.selenium.WebDriver driver, int timeOut)  
      static List<org.openqa.selenium.WebElement> presenceOfAllElements​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement... elements)
      check for presence Of All Elements element not have to be visible on page only present
      static List<org.openqa.selenium.WebElement> presenceOfAllElementsLocatedBy​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator)
      An expectation for checking that there is at least one element present on a web page.
      static org.openqa.selenium.WebElement presenceOfElementLocated​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator)
      An expectation for checking that an element is present on the DOM of a page.
      static boolean stalenessOf​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element)
      Wait until an element is no longer attached to the DOM.
      static boolean textMatches​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, Pattern pattern)
      An expectation for checking WebElement with given locator has text with a value as a part of it
      static boolean textToBe​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, String value)
      An expectation for checking WebElement with given locator has specific text
      static boolean textToBePresentInElement​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element, String text)
      An expectation for checking if the given text is present in the specified element.
      static boolean textToBePresentInElementLocated​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, String text)
      An expectation for checking if the given text is present in the element that matches the given locator.
      static boolean textToBePresentInElementValue​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator, String text)
      An expectation for checking if the given text is present in the specified elements value attribute.
      static boolean textToBePresentInElementValue​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element, String text)
      An expectation for checking if the given text is present in the specified elements value attribute.
      static boolean titleContains​(org.openqa.selenium.WebDriver driver, int timeOut, String title)
      An expectation for checking that the title contains a case-sensitive substring
      static boolean titleIs​(org.openqa.selenium.WebDriver driver, int timeOut, String title)
      An expectation for checking the title of a page.
      static boolean urlContains​(org.openqa.selenium.WebDriver driver, int timeOut, String fraction)
      An expectation for the URL of the current page to contain specific text.
      static boolean urlMatches​(org.openqa.selenium.WebDriver driver, int timeOut, String regex)
      Expectation for the URL to match a specific regular expression
      static boolean urlToBe​(org.openqa.selenium.WebDriver driver, int timeOut, String url)
      An expectation for the URL of the current page to be a specific url.
      static org.openqa.selenium.WebElement visibilityOf​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement element)
      An expectation for checking that an element, known to be present on the DOM of a page, is visible.
      static List<org.openqa.selenium.WebElement> visibilityOfAllElements​(org.openqa.selenium.WebDriver driver, int timeOut, List<org.openqa.selenium.WebElement> elements)
      An expectation for checking that all elements present on the web page that match the locator are visible.
      static List<org.openqa.selenium.WebElement> visibilityOfAllElements​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.WebElement... elements)
      An expectation for checking that all elements present on the web page that match the locator are visible.
      static List<org.openqa.selenium.WebElement> visibilityOfAllElementsLocatedBy​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator)
      An expectation for checking that all elements present on the web page that match the locator are visible.
      static org.openqa.selenium.WebElement visibilityOfElementLocated​(org.openqa.selenium.WebDriver driver, int timeOut, org.openqa.selenium.By locator)
      An expectation for checking that an element is present on the DOM of a page and visible.
    • Method Detail

      • milliseconds

        public static void milliseconds​(int milliseconds)
        wait by millisecond
        Parameters:
        milliseconds -
      • alertIsPresent

        public static org.openqa.selenium.Alert alertIsPresent​(org.openqa.selenium.WebDriver driver,
                                                               int timeOut,
                                                               org.openqa.selenium.By by)
        wait for alert to be on page
        Parameters:
        driver -
        timeOut -
        by -
        Returns:
        Alert
      • attributeContains

        public static boolean attributeContains​(org.openqa.selenium.WebDriver driver,
                                                int timeOut,
                                                org.openqa.selenium.By locator,
                                                String attribute,
                                                String value)
        An expectation for checking WebElement with given locator has attribute which contains specific value
        Parameters:
        locator - used to define WebElement to check its parameters
        attribute - used to define css or html attribute
        value - used as expected attribute value
        Returns:
        Boolean true when element has css or html attribute which contains the value
      • attributeContains

        public static boolean attributeContains​(org.openqa.selenium.WebDriver driver,
                                                int timeOut,
                                                org.openqa.selenium.WebElement element,
                                                String attribute,
                                                String value)
        An expectation for checking WebElement with given locator has attribute which contains specific value
        Parameters:
        element - used to check its parameters
        attribute - used to define css or html attribute
        value - used as expected attribute value
        Returns:
        Boolean true when element has css or html attribute which contains the value
      • attributeToBe

        public static boolean attributeToBe​(org.openqa.selenium.WebDriver driver,
                                            int timeOut,
                                            org.openqa.selenium.By locator,
                                            String attribute,
                                            String value)
        An expectation for checking WebElement with given locator has attribute with a specific value
        Parameters:
        locator - used to find the element
        attribute - used to define css or html attribute
        value - used as expected attribute value
        Returns:
        Boolean true when element has css or html attribute with the value
      • attributeToBe

        public static boolean attributeToBe​(org.openqa.selenium.WebDriver driver,
                                            int timeOut,
                                            org.openqa.selenium.WebElement element,
                                            String attribute,
                                            String value)
        An expectation for checking given WebElement has attribute with a specific value
        Parameters:
        element - used to check its parameters
        attribute - used to define css or html attribute
        value - used as expected attribute value
        Returns:
        Boolean true when element has css or html attribute with the value
      • attributeToBeNotEmpty

        public static boolean attributeToBeNotEmpty​(org.openqa.selenium.WebDriver driver,
                                                    int timeOut,
                                                    org.openqa.selenium.WebElement element,
                                                    String attribute)
        An expectation for checking WebElement any non empty value for given attribute
        Parameters:
        element - used to check its parameters
        attribute - used to define css or html attribute
        Returns:
        Boolean true when element has css or html attribute with non empty value
      • elementSelectionStateToBe

        public static boolean elementSelectionStateToBe​(org.openqa.selenium.WebDriver driver,
                                                        int timeOut,
                                                        org.openqa.selenium.By by,
                                                        boolean selected)
        Determine whether or not this element is selected or not. This operation only applies to inputelements such as checkboxes, options in a select and radio buttons.
        Parameters:
        driver -
        timeOut -
        by -
        selected -
        Returns:
        true if element was selected false other wise
      • elementSelectionStateToBe

        public static boolean elementSelectionStateToBe​(org.openqa.selenium.WebDriver driver,
                                                        int timeOut,
                                                        org.openqa.selenium.WebElement element,
                                                        boolean selected)
        Determine whether or not this element is selected or not. This operation only applies to inputelements such as checkboxes, options in a select and radio buttons.
        Parameters:
        driver -
        timeOut -
        element -
        selected -
        Returns:
        true if element was selected false other wise
      • elementToBeClickable

        public static org.openqa.selenium.WebElement elementToBeClickable​(org.openqa.selenium.WebDriver driver,
                                                                          int timeOut,
                                                                          org.openqa.selenium.By locator)
        An expectation for checking an element is visible and enabled such that you can click it.
        Parameters:
        locator - used to find the element
        Returns:
        the WebElement once it is located and clickable (visible and enabled)
      • elementToBeClickable

        public static org.openqa.selenium.WebElement elementToBeClickable​(org.openqa.selenium.WebDriver driver,
                                                                          int timeOut,
                                                                          org.openqa.selenium.WebElement element)
        An expectation for checking an element is visible and enabled such that you can click it.
        Parameters:
        element - the WebElement
        Returns:
        the (same) WebElement once it is clickable (visible and enabled)
      • elementToBeSelected

        public static boolean elementToBeSelected​(org.openqa.selenium.WebDriver driver,
                                                  int timeOut,
                                                  org.openqa.selenium.By locator)
        An expectation for checking if the given element is selected.
        Parameters:
        locator - By to be selected
        Returns:
        true once the element is selected
      • elementToBeSelected

        public static boolean elementToBeSelected​(org.openqa.selenium.WebDriver driver,
                                                  int timeOut,
                                                  org.openqa.selenium.WebElement element)
        An expectation for checking if the given element is selected.
        Parameters:
        element - WebElement to be selected
        Returns:
        true once the element is selected
      • frameToBeAvailableAndSwitchToIt

        public static org.openqa.selenium.WebDriver frameToBeAvailableAndSwitchToIt​(org.openqa.selenium.WebDriver driver,
                                                                                    int timeOut,
                                                                                    org.openqa.selenium.By locator)
        An expectation for checking whether the given frame is available to switch to.

        If the frame is available it switches the given driver to the specified frame.

        Parameters:
        locator - used to find the frame
        Returns:
        WebDriver instance after frame has been switched
      • frameToBeAvailableAndSwitchToIt

        public static org.openqa.selenium.WebDriver frameToBeAvailableAndSwitchToIt​(org.openqa.selenium.WebDriver driver,
                                                                                    int timeOut,
                                                                                    int frameLocator)
        An expectation for checking whether the given frame is available to switch to.

        If the frame is available it switches the given driver to the specified frameIndex.

        Parameters:
        frameLocator - used to find the frame (index)
        Returns:
        WebDriver instance after frame has been switched
      • frameToBeAvailableAndSwitchToIt

        public static org.openqa.selenium.WebDriver frameToBeAvailableAndSwitchToIt​(org.openqa.selenium.WebDriver driver,
                                                                                    int timeOut,
                                                                                    String frameLocator)
        An expectation for checking whether the given frame is available to switch to.

        If the frame is available it switches the given driver to the specified frame.

        Parameters:
        frameLocator - used to find the frame (id or name)
        Returns:
        WebDriver instance after frame has been switched
      • frameToBeAvailableAndSwitchToIt

        public static org.openqa.selenium.WebDriver frameToBeAvailableAndSwitchToIt​(org.openqa.selenium.WebDriver driver,
                                                                                    int timeOut,
                                                                                    org.openqa.selenium.WebElement frameLocator)
        An expectation for checking whether the given frame is available to switch to.

        If the frame is available it switches the given driver to the specified webelement.

        Parameters:
        frameLocator - used to find the frame (webelement)
        Returns:
        WebDriver instance after frame has been switched
      • invisibilityOf

        public static boolean invisibilityOf​(org.openqa.selenium.WebDriver driver,
                                             int timeOut,
                                             org.openqa.selenium.WebElement element)
        An expectation for checking the element to be invisible
        Parameters:
        element - used to check its invisibility
        Returns:
        Boolean true when elements is not visible anymore
      • invisibilityOfAllElements

        public static boolean invisibilityOfAllElements​(org.openqa.selenium.WebDriver driver,
                                                        int timeOut,
                                                        List<org.openqa.selenium.WebElement> elements)
        An expectation for checking all elements from given list to be invisible
        Parameters:
        elements - used to check their invisibility
        Returns:
        Boolean true when all elements are not visible anymore
      • invisibilityOfAllElements

        public static boolean invisibilityOfAllElements​(org.openqa.selenium.WebDriver driver,
                                                        int timeOut,
                                                        org.openqa.selenium.WebElement... elements)
        An expectation for checking all elements from given list to be invisible
        Parameters:
        elements - used to check their invisibility
        Returns:
        Boolean true when all elements are not visible anymore
      • invisibilityOfElementLocated

        public static boolean invisibilityOfElementLocated​(org.openqa.selenium.WebDriver driver,
                                                           int timeOut,
                                                           org.openqa.selenium.By locator)
        An expectation for checking that an element is either invisible or not present on the DOM.
        Parameters:
        locator - used to find the element
        Returns:
        true if the element is not displayed or the element doesn't exist or stale element
      • invisibilityOfElementWithText

        public static boolean invisibilityOfElementWithText​(org.openqa.selenium.WebDriver driver,
                                                            int timeOut,
                                                            org.openqa.selenium.By locator,
                                                            String text)
        An expectation for checking that an element with text is either invisible or not present on the DOM.
        Parameters:
        locator - used to find the element
        text - of the element
        Returns:
        true if no such element, stale element or displayed text not equal that provided
      • numberOfElementsToBe

        public static List<org.openqa.selenium.WebElement> numberOfElementsToBe​(org.openqa.selenium.WebDriver driver,
                                                                                int timeOut,
                                                                                org.openqa.selenium.By locator,
                                                                                int number)
        An expectation for checking number of WebElements with given locator
        Parameters:
        locator - used to find the element
        number - used to define number of elements
        Returns:
        Boolean true when size of elements list is equal to defined
      • numberOfElementsToBeLessThan

        public static List<org.openqa.selenium.WebElement> numberOfElementsToBeLessThan​(org.openqa.selenium.WebDriver driver,
                                                                                        int timeOut,
                                                                                        org.openqa.selenium.By locator,
                                                                                        int number)
        An expectation for checking number of WebElements with given locator being less than defined number
        Parameters:
        locator - used to find the element
        number - used to define maximum number of elements
        Returns:
        Boolean true when size of elements list is less than defined
      • numberOfElementsToBeMoreThan

        public static List<org.openqa.selenium.WebElement> numberOfElementsToBeMoreThan​(org.openqa.selenium.WebDriver driver,
                                                                                        int timeOut,
                                                                                        org.openqa.selenium.By locator,
                                                                                        int number)
        An expectation for checking number of WebElements with given locator being more than defined number
        Parameters:
        locator - used to find the element
        number - used to define minimum number of elements
        Returns:
        list of found WebElement by locator
      • numberOfWindowsToBe

        public static boolean numberOfWindowsToBe​(org.openqa.selenium.WebDriver driver,
                                                  int timeOut,
                                                  int expectedNumberOfWindows)
        An expectation for checking number of window with given by expectedNumberOfWindows
        Parameters:
        driver -
        timeOut -
        expectedNumberOfWindows -
        Returns:
        true if the number of window with expectedNumberOfWindows is correct
      • presenceOfAllElementsLocatedBy

        public static List<org.openqa.selenium.WebElement> presenceOfAllElementsLocatedBy​(org.openqa.selenium.WebDriver driver,
                                                                                          int timeOut,
                                                                                          org.openqa.selenium.By locator)
        An expectation for checking that there is at least one element present on a web page.
        Parameters:
        locator - used to find the element
        Returns:
        the list of WebElements once they are located
      • presenceOfAllElements

        public static List<org.openqa.selenium.WebElement> presenceOfAllElements​(org.openqa.selenium.WebDriver driver,
                                                                                 int timeOut,
                                                                                 org.openqa.selenium.WebElement... elements)
        check for presence Of All Elements element not have to be visible on page only present
        Parameters:
        driver -
        timeOut -
        elements -
        Returns:
        the list of WebElements once they are located on page
      • presenceOfElementLocated

        public static org.openqa.selenium.WebElement presenceOfElementLocated​(org.openqa.selenium.WebDriver driver,
                                                                              int timeOut,
                                                                              org.openqa.selenium.By locator)
        An expectation for checking that an element is present on the DOM of a page. This does not necessarily mean that the element is visible.
        Parameters:
        locator - used to find the element
        Returns:
        the WebElement once it is located
      • stalenessOf

        public static boolean stalenessOf​(org.openqa.selenium.WebDriver driver,
                                          int timeOut,
                                          org.openqa.selenium.WebElement element)
        Wait until an element is no longer attached to the DOM.
        Parameters:
        element - The element to wait for.
        Returns:
        false if the element is still attached to the DOM, true otherwise.
      • textMatches

        public static boolean textMatches​(org.openqa.selenium.WebDriver driver,
                                          int timeOut,
                                          org.openqa.selenium.By locator,
                                          Pattern pattern)
        An expectation for checking WebElement with given locator has text with a value as a part of it
        Parameters:
        locator - used to find the element
        pattern - used as expected text matcher pattern
        Returns:
        Boolean true when element has text value containing @value
      • textToBe

        public static boolean textToBe​(org.openqa.selenium.WebDriver driver,
                                       int timeOut,
                                       org.openqa.selenium.By locator,
                                       String value)
        An expectation for checking WebElement with given locator has specific text
        Parameters:
        locator - used to find the element
        value - used as expected text
        Returns:
        Boolean true when element has text value equal to @value
      • textToBePresentInElement

        public static boolean textToBePresentInElement​(org.openqa.selenium.WebDriver driver,
                                                       int timeOut,
                                                       org.openqa.selenium.WebElement element,
                                                       String text)
        An expectation for checking if the given text is present in the specified element.
        Parameters:
        element - the WebElement
        text - to be present in the element
        Returns:
        true once the element contains the given text
      • textToBePresentInElementLocated

        public static boolean textToBePresentInElementLocated​(org.openqa.selenium.WebDriver driver,
                                                              int timeOut,
                                                              org.openqa.selenium.By locator,
                                                              String text)
        An expectation for checking if the given text is present in the element that matches the given locator.
        Parameters:
        locator - used to find the element
        text - to be present in the element found by the locator
        Returns:
        true once the first element located by locator contains the given text
      • textToBePresentInElementValue

        public static boolean textToBePresentInElementValue​(org.openqa.selenium.WebDriver driver,
                                                            int timeOut,
                                                            org.openqa.selenium.By locator,
                                                            String text)
        An expectation for checking if the given text is present in the specified elements value attribute.
        Parameters:
        locator - used to find the element
        text - to be present in the value attribute of the element found by the locator
        Returns:
        true once the value attribute of the first element located by locator contains the given text
      • textToBePresentInElementValue

        public static boolean textToBePresentInElementValue​(org.openqa.selenium.WebDriver driver,
                                                            int timeOut,
                                                            org.openqa.selenium.WebElement element,
                                                            String text)
        An expectation for checking if the given text is present in the specified elements value attribute.
        Parameters:
        element - the WebElement
        text - to be present in the element's value attribute
        Returns:
        true once the element's value attribute contains the given text
      • titleContains

        public static boolean titleContains​(org.openqa.selenium.WebDriver driver,
                                            int timeOut,
                                            String title)
        An expectation for checking that the title contains a case-sensitive substring
        Parameters:
        title - the fragment of title expected
        Returns:
        true when the title matches, false otherwise
      • titleIs

        public static boolean titleIs​(org.openqa.selenium.WebDriver driver,
                                      int timeOut,
                                      String title)
        An expectation for checking the title of a page.
        Parameters:
        title - the expected title, which must be an exact match
        Returns:
        true when the title matches, false otherwise
      • urlContains

        public static boolean urlContains​(org.openqa.selenium.WebDriver driver,
                                          int timeOut,
                                          String fraction)
        An expectation for the URL of the current page to contain specific text.
        Parameters:
        fraction - the fraction of the url that the page should be on
        Returns:
        true when the URL contains the text
      • urlMatches

        public static boolean urlMatches​(org.openqa.selenium.WebDriver driver,
                                         int timeOut,
                                         String regex)
        Expectation for the URL to match a specific regular expression
        Parameters:
        regex - the regular expression that the URL should match
        Returns:
        true if the URL matches the specified regular expression
      • urlToBe

        public static boolean urlToBe​(org.openqa.selenium.WebDriver driver,
                                      int timeOut,
                                      String url)
        An expectation for the URL of the current page to be a specific url.
        Parameters:
        url - the url that the page should be on
        Returns:
        true when the URL is what it should be
      • visibilityOf

        public static org.openqa.selenium.WebElement visibilityOf​(org.openqa.selenium.WebDriver driver,
                                                                  int timeOut,
                                                                  org.openqa.selenium.WebElement element)
        An expectation for checking that an element, known to be present on the DOM of a page, is visible. Visibility means that the element is not only displayed but also has a height and width that is greater than 0.
        Parameters:
        element - the WebElement
        Returns:
        the (same) WebElement once it is visible
      • visibilityOfAllElements

        public static List<org.openqa.selenium.WebElement> visibilityOfAllElements​(org.openqa.selenium.WebDriver driver,
                                                                                   int timeOut,
                                                                                   List<org.openqa.selenium.WebElement> elements)
        An expectation for checking that all elements present on the web page that match the locator are visible. Visibility means that the elements are not only displayed but also have a height and width that is greater than 0.
        Parameters:
        elements - list of WebElements
        Returns:
        the list of WebElements once they are located
      • visibilityOfAllElements

        public static List<org.openqa.selenium.WebElement> visibilityOfAllElements​(org.openqa.selenium.WebDriver driver,
                                                                                   int timeOut,
                                                                                   org.openqa.selenium.WebElement... elements)
        An expectation for checking that all elements present on the web page that match the locator are visible. Visibility means that the elements are not only displayed but also have a height and width that is greater than 0.
        Parameters:
        elements - list of WebElements
        Returns:
        the list of WebElements once they are located
      • visibilityOfAllElementsLocatedBy

        public static List<org.openqa.selenium.WebElement> visibilityOfAllElementsLocatedBy​(org.openqa.selenium.WebDriver driver,
                                                                                            int timeOut,
                                                                                            org.openqa.selenium.By locator)
        An expectation for checking that all elements present on the web page that match the locator are visible. Visibility means that the elements are not only displayed but also have a height and width that is greater than 0.
        Parameters:
        locator - used to find the element
        Returns:
        the list of WebElements once they are located
      • visibilityOfElementLocated

        public static org.openqa.selenium.WebElement visibilityOfElementLocated​(org.openqa.selenium.WebDriver driver,
                                                                                int timeOut,
                                                                                org.openqa.selenium.By locator)
        An expectation for checking that an element is present on the DOM of a page and visible. Visibility means that the element is not only displayed but also has a height and width that is greater than 0.
        Parameters:
        locator - used to find the element
        Returns:
        the WebElement once it is located and visible
      • containsText

        public static boolean containsText​(org.openqa.selenium.WebDriver driver,
                                           int timeOut,
                                           org.openqa.selenium.By by,
                                           String textToBeContains)
        Parameters:
        driver -
        timeOut -
        by -
        textToBeContains -
        Returns:
      • pageToFullyLoad

        public static void pageToFullyLoad​(org.openqa.selenium.WebDriver driver,
                                           int timeOut)
      • numberOfWindowsToBeAndSwitchTo

        public static void numberOfWindowsToBeAndSwitchTo​(org.openqa.selenium.WebDriver driver,
                                                          int timeOut,
                                                          int expectedNumberOfWindows,
                                                          int switchToWindowNumber)
        waits for number of window to be user expected number of windows and switch to user window number
        Parameters:
        driver -
        timeOut -
        expectedNumberOfWindows -
        switchToWindowNumber -