Interface WebDriver.Timeouts
-
- All Known Implementing Classes:
RemoteWebDriver.RemoteWebDriverOptions.RemoteTimeouts
- 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 Default Methods Deprecated Methods Modifier and Type Method Description default java.time.Duration
getImplicitWaitTimeout()
Gets the amount of time the driver should wait when searching for an element if it is not immediately present.default java.time.Duration
getPageLoadTimeout()
Gets the amount of time to wait for a page load to complete before throwing an error.default java.time.Duration
getScriptTimeout()
Gets the amount of time to wait for an asynchronous script to finish execution before throwing an error.WebDriver.Timeouts
implicitlyWait(long time, java.util.concurrent.TimeUnit unit)
Deprecated.UseimplicitlyWait(Duration)
Specifies the amount of time the driver should wait when searching for an element if it is not immediately present.default WebDriver.Timeouts
implicitlyWait(java.time.Duration duration)
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)
Deprecated.UsepageLoadTimeout(Duration)
Sets the amount of time to wait for a page load to complete before throwing an error.default WebDriver.Timeouts
pageLoadTimeout(java.time.Duration duration)
Sets the amount of time to wait for a page load to complete before throwing an error.default WebDriver.Timeouts
scriptTimeout(java.time.Duration duration)
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error.WebDriver.Timeouts
setScriptTimeout(long time, java.util.concurrent.TimeUnit unit)
Deprecated.UsesetScriptTimeout(Duration)
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error.default WebDriver.Timeouts
setScriptTimeout(java.time.Duration duration)
Deprecated.
-
-
-
Method Detail
-
implicitlyWait
@Deprecated WebDriver.Timeouts implicitlyWait(long time, java.util.concurrent.TimeUnit unit)
Deprecated.UseimplicitlyWait(Duration)
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.
If the timeout is negative, not null, or greater than 2e16 - 1, an error code with invalid argument will be returned.
- Parameters:
time
- The amount of time to wait.unit
- The unit of measure fortime
.- Returns:
- A self reference.
-
implicitlyWait
default WebDriver.Timeouts implicitlyWait(java.time.Duration duration)
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.
If the timeout is negative, not null, or greater than 2e16 - 1, an error code with invalid argument will be returned.
- Parameters:
duration
- The duration to wait.- Returns:
- A self reference.
-
getImplicitWaitTimeout
default java.time.Duration getImplicitWaitTimeout()
Gets the amount of time the driver should wait when searching for an element if it is not immediately present.- Returns:
- The amount of time the driver should wait when searching for an element.
- See Also:
- W3C WebDriver
-
setScriptTimeout
@Deprecated WebDriver.Timeouts setScriptTimeout(long time, java.util.concurrent.TimeUnit unit)
Deprecated.UsesetScriptTimeout(Duration)
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error. If the timeout is negative, not null, or greater than 2e16 - 1, an error code with invalid argument will be returned.- Parameters:
time
- The timeout value.unit
- The unit of time.- Returns:
- A self reference.
- See Also:
JavascriptExecutor.executeAsyncScript(String, Object...)
, W3C WebDriver, W3C WebDriver
-
setScriptTimeout
@Deprecated default WebDriver.Timeouts setScriptTimeout(java.time.Duration duration)
Deprecated.Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error. If the timeout is negative, not null, or greater than 2e16 - 1, an error code with invalid argument will be returned.- Parameters:
duration
- The timeout value.- Returns:
- A self reference.
- See Also:
JavascriptExecutor.executeAsyncScript(String, Object...)
, W3C WebDriver, W3C WebDriver
-
scriptTimeout
default WebDriver.Timeouts scriptTimeout(java.time.Duration duration)
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an error. If the timeout is negative, not null, or greater than 2e16 - 1, an error code with invalid argument will be returned.- Parameters:
duration
- The timeout value.- Returns:
- A self reference.
- See Also:
JavascriptExecutor.executeAsyncScript(String, Object...)
, W3C WebDriver, W3C WebDriver
-
getScriptTimeout
default java.time.Duration getScriptTimeout()
Gets the amount of time to wait for an asynchronous script to finish execution before throwing an error. If the timeout is negative, not null, or greater than 2e16 - 1, an error code with invalid argument will be returned.- Returns:
- The amount of time to wait for an asynchronous script to finish execution.
- See Also:
- W3C WebDriver, W3C WebDriver
-
pageLoadTimeout
@Deprecated WebDriver.Timeouts pageLoadTimeout(long time, java.util.concurrent.TimeUnit unit)
Deprecated.UsepageLoadTimeout(Duration)
Sets the amount of time to wait for a page load to complete before throwing an error. If the timeout is negative, not null, or greater than 2e16 - 1, an error code with invalid argument will be returned.- Parameters:
time
- The timeout value.unit
- The unit of time.- Returns:
- A Timeouts interface.
- See Also:
- W3C WebDriver, W3C WebDriver
-
pageLoadTimeout
default WebDriver.Timeouts pageLoadTimeout(java.time.Duration duration)
Sets the amount of time to wait for a page load to complete before throwing an error. If the timeout is negative, not null, or greater than 2e16 - 1, an error code with invalid argument will be returned.- Parameters:
duration
- The timeout value.- Returns:
- A Timeouts interface.
- See Also:
- W3C WebDriver, W3C WebDriver
-
getPageLoadTimeout
default java.time.Duration getPageLoadTimeout()
Gets the amount of time to wait for a page load to complete before throwing an error. If the timeout is negative, not null, or greater than 2e16 - 1, an error code with invalid argument will be returned.- Returns:
- The amount of time to wait for a page load to complete.
- See Also:
- W3C WebDriver, W3C WebDriver
-
-