public abstract class CallbackWait extends Object
Wait that uses Callable
and that may have its timeout and polling interval configured on the fly.
Each CallbackWait instance defines the maximum amount of time to wait for a condition, as well as
the frequency with which to check the condition. Furthermore, the user may configure the wait to
ignore specific types of exceptions whilst waiting, such as NoSuchElementException when searching for an element
on the page.| Constructor and Description |
|---|
CallbackWait()
Callback with a fresh clock and a the system's default thread sleeper.
|
CallbackWait(org.openqa.selenium.support.ui.Clock clock,
org.openqa.selenium.support.ui.Sleeper sleeper)
Callback with a specified clock and sleeper.
|
| Modifier and Type | Method and Description |
|---|---|
CallbackWait |
ignoreAll(Collection<Class<? extends RuntimeException>> types)
Configures this instance to ignore specific types of exceptions while waiting for a condition.
|
CallbackWait |
ignoring(Class<? extends RuntimeException> exceptionType) |
CallbackWait |
ignoring(Class<? extends RuntimeException> firstType,
Class<? extends RuntimeException> secondType) |
CallbackWait |
pollingEvery(org.openqa.selenium.support.ui.Duration interval)
Sets how often the condition should be evaluated.
|
protected RuntimeException |
timeoutException(String message,
Exception lastException)
Throws a timeout exception.
|
<X> X |
until(Callable<X> condition)
Repeatedly applies this instance's input value to the given callable until one of the following
occurs:
the function returns neither null nor false. the function throws an unignored
exception. the timeout expires. the current thread is interrupted.
|
CallbackWait |
withMessage(String message)
Sets the message to be displayed when time expires.
|
CallbackWait |
withTimeout(org.openqa.selenium.support.ui.Duration timeout)
Sets how long to wait for the evaluated condition to be true.
|
public CallbackWait()
public CallbackWait(org.openqa.selenium.support.ui.Clock clock,
org.openqa.selenium.support.ui.Sleeper sleeper)
clock - the clock to use when measuring the timeoutsleeper - used to put the thread to sleep between evaluation loopspublic CallbackWait withTimeout(org.openqa.selenium.support.ui.Duration timeout)
FluentWait.FIVE_HUNDRED_MILLIS.timeout - the timeout durationpublic CallbackWait withMessage(String message)
message - to be appended to defaultpublic CallbackWait pollingEvery(org.openqa.selenium.support.ui.Duration interval)
FluentWait.FIVE_HUNDRED_MILLIS.interval - the interval durationpublic CallbackWait ignoreAll(Collection<Class<? extends RuntimeException>> types)
types - the types of exceptions to ignorepublic CallbackWait ignoring(Class<? extends RuntimeException> exceptionType)
ignoreAll(java.util.Collection)public CallbackWait ignoring(Class<? extends RuntimeException> firstType, Class<? extends RuntimeException> secondType)
ignoreAll(java.util.Collection)public <X> X until(Callable<X> condition)
condition - the Callable to evaluateprotected RuntimeException timeoutException(String message, Exception lastException)
message - the timeout messagelastException - the last exception to be thrown and subsequently suppressed while waiting
on a functionCopyright © 2013. All Rights Reserved.