public class DynamicWait<T>
extends java.lang.Object
Constructor and Description |
---|
DynamicWait(T input) |
Modifier and Type | Method and Description |
---|---|
static long |
duration(long time,
java.util.concurrent.TimeUnit unit) |
static long |
getDefaultInterval() |
static long |
getDefaultTimeout() |
DynamicWait<T> |
ignoring(java.lang.Class<? extends java.lang.Throwable>... types)
Configures this instance to ignore specific types of exceptions while
waiting for a condition.
|
DynamicWait<T> |
pollingEvery(long duration,
java.util.concurrent.TimeUnit unit)
Sets how often the condition should be evaluated.
|
<V> V |
until(com.google.common.base.Function<? super T,V> isTrue)
Repeatedly applies this instance's input value to the given function
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
|
void |
until(com.google.common.base.Predicate<T> isTrue)
Repeatedly applies this instance's input value to the given predicate
until the timeout expires or the predicate evaluates to true.
|
DynamicWait<T> |
withMessage(java.lang.String message)
Sets the message to be displayed when time expires.
|
DynamicWait<T> |
withMessage(com.google.common.base.Supplier<java.lang.String> messageSupplier)
Sets the message to be evaluated and displayed when time expires.
|
DynamicWait<T> |
withTimeout(long duration,
java.util.concurrent.TimeUnit unit)
Sets how long to wait for the evaluated condition to be true.
|
public DynamicWait(T input)
public DynamicWait<T> withMessage(java.lang.String message)
message
- to be appended to default.public DynamicWait<T> withMessage(com.google.common.base.Supplier<java.lang.String> messageSupplier)
messageSupplier
- to be evaluated on failure and appended to default.public DynamicWait<T> pollingEvery(long duration, java.util.concurrent.TimeUnit unit)
In reality, the interval may be greater as the cost of actually
evaluating a condition function is not factored in. The default polling
interval is #FIVE_HUNDRED_MILLIS
.
duration
- The timeout duration.unit
- The unit of time.public void until(com.google.common.base.Predicate<T> isTrue)
isTrue
- The predicate to wait on.org.openqa.selenium.TimeoutException
- If the timeout expires.public <V> V until(com.google.common.base.Function<? super T,V> isTrue)
V
- The function's expected return type.isTrue
- the parameter to pass to the ExpectedCondition
org.openqa.selenium.TimeoutException
- If the timeout expires.public DynamicWait<T> withTimeout(long duration, java.util.concurrent.TimeUnit unit)
#FIVE_HUNDRED_MILLIS
.duration
- The timeout duration.unit
- The unit of time.@SafeVarargs public final DynamicWait<T> ignoring(java.lang.Class<? extends java.lang.Throwable>... types)
K
- an Exception that extends Throwabletypes
- The types of exceptions to ignore.public static long getDefaultTimeout()
public static long getDefaultInterval()
public static long duration(long time, java.util.concurrent.TimeUnit unit)
Copyright © 2000 Infostretch Corp.