Package org.openqa.selenium.support.ui
Class WebDriverWait
- java.lang.Object
-
- org.openqa.selenium.support.ui.FluentWait<WebDriver>
-
- org.openqa.selenium.support.ui.WebDriverWait
-
public class WebDriverWait extends FluentWait<WebDriver>
A specialization ofFluentWait
that uses WebDriver instances.
-
-
Field Summary
-
Fields inherited from class org.openqa.selenium.support.ui.FluentWait
DEFAULT_SLEEP_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description WebDriverWait(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.WebDriverWait(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.WebDriverWait(WebDriver driver, java.time.Duration timeout, java.time.Duration sleep, java.time.Clock clock, Sleeper sleeper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.RuntimeException
timeoutException(java.lang.String message, java.lang.Throwable lastException)
Throws a timeout exception.-
Methods inherited from class org.openqa.selenium.support.ui.FluentWait
ignoreAll, ignoring, ignoring, pollingEvery, until, withMessage, withMessage, withTimeout
-
-
-
-
Constructor Detail
-
WebDriverWait
public WebDriverWait(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 conditionstimeout
- The timeout when an expectation is called- See Also:
FluentWait.ignoring(java.lang.Class)
-
WebDriverWait
public WebDriverWait(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 conditionstimeout
- The timeout in seconds when an expectation is calledsleep
- The duration in milliseconds to sleep between polls.- See Also:
FluentWait.ignoring(java.lang.Class)
-
WebDriverWait
public WebDriverWait(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 conditionsclock
- used when measuring the timeoutsleeper
- used to make the current thread go to sleeptimeout
- the timeout when an expectation is calledsleep
- 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 classFluentWait<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.
-
-