Class WebDriverWait

  • All Implemented Interfaces:
    Wait<org.openqa.selenium.WebDriver>

    public class WebDriverWait
    extends FluentWait<org.openqa.selenium.WebDriver>
    A specialization of FluentWait that uses WebDriver instances.
    • Constructor Detail

      • WebDriverWait

        @Deprecated
        public WebDriverWait​(org.openqa.selenium.WebDriver driver,
                             long timeoutInSeconds)
        Deprecated.
        Wait will ignore instances of NotFoundException that are encountered (thrown) by default in the 'until' condition, and immediately propagate all others. You can add more to the ignore list by calling ignoring(exceptions to add).
        Parameters:
        driver - The WebDriver instance to pass to the expected conditions
        timeoutInSeconds - The timeout in seconds when an expectation is called
        See Also:
        FluentWait.ignoring(java.lang.Class)
      • WebDriverWait

        public WebDriverWait​(org.openqa.selenium.WebDriver driver,
                             java.time.Duration timeout)
        Wait will ignore instances of NotFoundException that are encountered (thrown) by default in the 'until' condition, and immediately propagate all others. You can add more to the ignore list by calling ignoring(exceptions to add).
        Parameters:
        driver - The WebDriver instance to pass to the expected conditions
        timeout - The timeout when an expectation is called
        See Also:
        FluentWait.ignoring(java.lang.Class)
      • WebDriverWait

        @Deprecated
        public WebDriverWait​(org.openqa.selenium.WebDriver driver,
                             long timeoutInSeconds,
                             long sleepInMillis)
        Wait will ignore instances of NotFoundException that are encountered (thrown) by default in the 'until' condition, and immediately propagate all others. You can add more to the ignore list by calling ignoring(exceptions to add).
        Parameters:
        driver - The WebDriver instance to pass to the expected conditions
        timeoutInSeconds - The timeout in seconds when an expectation is called
        sleepInMillis - The duration in milliseconds to sleep between polls.
        See Also:
        FluentWait.ignoring(java.lang.Class)
      • WebDriverWait

        public WebDriverWait​(org.openqa.selenium.WebDriver driver,
                             java.time.Duration timeout,
                             java.time.Duration sleep)
        Wait will ignore instances of NotFoundException that are encountered (thrown) by default in the 'until' condition, and immediately propagate all others. You can add more to the ignore list by calling ignoring(exceptions to add).
        Parameters:
        driver - The WebDriver instance to pass to the expected conditions
        timeout - The timeout in seconds when an expectation is called
        sleep - The duration in milliseconds to sleep between polls.
        See Also:
        FluentWait.ignoring(java.lang.Class)
      • WebDriverWait

        @Deprecated
        public WebDriverWait​(org.openqa.selenium.WebDriver driver,
                             java.time.Clock clock,
                             Sleeper sleeper,
                             long timeoutInSeconds,
                             long sleepInMillis)
        Parameters:
        driver - the WebDriver instance to pass to the expected conditions
        clock - used when measuring the timeout
        sleeper - used to make the current thread go to sleep
        timeoutInSeconds - the timeout in seconds when an expectation is called
        sleepInMillis - the timeout in millis used whilst sleeping
      • WebDriverWait

        public WebDriverWait​(org.openqa.selenium.WebDriver driver,
                             java.time.Duration timeout,
                             java.time.Duration sleep,
                             java.time.Clock clock,
                             Sleeper sleeper)
        Parameters:
        driver - the WebDriver instance to pass to the expected conditions
        clock - used when measuring the timeout
        sleeper - used to make the current thread go to sleep
        timeout - the timeout when an expectation is called
        sleep - the timeout used whilst sleeping
    • Method Detail

      • timeoutException

        protected java.lang.RuntimeException timeoutException​(java.lang.String message,
                                                              java.lang.Throwable lastException)
        Description copied from class: FluentWait
        Throws a timeout exception. This method may be overridden to throw an exception that is idiomatic for a particular test infrastructure, such as an AssertionError in JUnit4.
        Overrides:
        timeoutException in class FluentWait<org.openqa.selenium.WebDriver>
        Parameters:
        message - The timeout message.
        lastException - The last exception to be thrown and subsequently suppressed while waiting on a function.
        Returns:
        Nothing will ever be returned; this return type is only specified as a convenience.