Class WebDriverWait

java.lang.Object
org.openqa.selenium.support.ui.FluentWait<WebDriver>
org.openqa.selenium.support.ui.WebDriverWait
All Implemented Interfaces:
Wait<WebDriver>

public class WebDriverWait extends FluentWait<WebDriver>
A specialization of FluentWait that uses WebDriver instances.
  • Constructor Details

    • WebDriverWait

      public WebDriverWait(WebDriver driver, 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:
    • WebDriverWait

      public WebDriverWait(WebDriver driver, Duration timeout, 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:
    • WebDriverWait

      public WebDriverWait(WebDriver driver, Duration timeout, Duration sleep, 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 Details

    • timeoutException

      protected RuntimeException timeoutException(String message, 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<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.