Interface WebDriver.Timeouts

  • Enclosing interface:
    WebDriver

    public static interface WebDriver.Timeouts
    An interface for managing timeout behavior for WebDriver instances.

    See W3C WebDriver specification for more details.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      WebDriver.Timeouts implicitlyWait​(long time, java.util.concurrent.TimeUnit unit)
      Specifies the amount of time the driver should wait when searching for an element if it is not immediately present.
      WebDriver.Timeouts pageLoadTimeout​(long time, java.util.concurrent.TimeUnit unit)
      Sets the amount of time to wait for a page load to complete before throwing an error.
      WebDriver.Timeouts setScriptTimeout​(long time, java.util.concurrent.TimeUnit unit)
      Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error.
    • Method Detail

      • implicitlyWait

        WebDriver.Timeouts implicitlyWait​(long time,
                                          java.util.concurrent.TimeUnit unit)
        Specifies the amount of time the driver should wait when searching for an element if it is not immediately present.

        When searching for a single element, the driver should poll the page until the element has been found, or this timeout expires before throwing a NoSuchElementException. When searching for multiple elements, the driver should poll the page until at least one element has been found or this timeout has expired.

        Increasing the implicit wait timeout should be used judiciously as it will have an adverse effect on test run time, especially when used with slower location strategies like XPath.

        Parameters:
        time - The amount of time to wait.
        unit - The unit of measure for time.
        Returns:
        A self reference.
      • setScriptTimeout

        WebDriver.Timeouts setScriptTimeout​(long time,
                                            java.util.concurrent.TimeUnit unit)
        Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error. If the timeout is negative, then the script will be allowed to run indefinitely.
        Parameters:
        time - The timeout value.
        unit - The unit of time.
        Returns:
        A self reference.
        See Also:
        JavascriptExecutor.executeAsyncScript(String, Object...)
      • pageLoadTimeout

        WebDriver.Timeouts pageLoadTimeout​(long time,
                                           java.util.concurrent.TimeUnit unit)
        Sets the amount of time to wait for a page load to complete before throwing an error. The timeout value specified should be a positive number.
        Parameters:
        time - The timeout value.
        unit - The unit of time.
        Returns:
        A Timeouts interface.