public final class WebDriverPoller extends Object
Function from WebDriver to boolean.
ElementConditions contains factory methods to easily create some commonly used conditions.
The DEFAULT_TIMEOUT and DEFAULT_TIMEOUT_UNIT specify the default timeout used when
no explicit timeout is provided by the client, which is currently 30 seconds. Clients are encouraged to use
their own timeout specific to the situation.
NOTE: the default poll interval used by this class is as in the underlying WebDriverWait and is currently
500ms (subject to change as the underlying WebDriverWait implementation changes. This may be generally
acceptable, but may not be granular enough for some scenarios (e.g. performance testing).
Example usage:
{@codeElementConditions,
WebDriverWait| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_TIMEOUT |
static TimeUnit |
DEFAULT_TIMEOUT_UNIT |
| Constructor and Description |
|---|
WebDriverPoller(org.openqa.selenium.WebDriver webDriver) |
WebDriverPoller(org.openqa.selenium.WebDriver webDriver,
long timeout,
TimeUnit timeUnit) |
| Modifier and Type | Method and Description |
|---|---|
void |
waitUntil(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> condition)
Wait until condition is true, up to the default timeout.
|
void |
waitUntil(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> condition,
long timeoutInSeconds)
Wait until condition up to the timeoutInSeconds.
|
void |
waitUntil(com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> condition,
long timeout,
TimeUnit unit)
Wait until condition up to the timeout specified by unit.
|
void |
waitUntil(org.openqa.selenium.WebElement element,
org.hamcrest.Matcher<? super org.openqa.selenium.WebElement> condition)
Wait until condition is
true for element, up to the default timeout. |
void |
waitUntil(org.openqa.selenium.WebElement element,
org.hamcrest.Matcher<? super org.openqa.selenium.WebElement> condition,
long timeoutInSeconds)
Wait until
condition is true for element, up to the timeoutInSeconds. |
void |
waitUntil(org.openqa.selenium.WebElement element,
org.hamcrest.Matcher<? super org.openqa.selenium.WebElement> condition,
long timeout,
TimeUnit unit)
Wait until condition is
true for element, up to the timeout specified
by unit. |
void |
waitUntil(org.openqa.selenium.WebElement element,
com.google.common.base.Predicate<org.openqa.selenium.WebElement> condition)
Wait until condition is
true for element, up to the default timeout. |
void |
waitUntil(org.openqa.selenium.WebElement element,
com.google.common.base.Predicate<org.openqa.selenium.WebElement> condition,
long timeoutInSeconds)
Wait until condition is
true for element, up to the timeoutInSeconds. |
void |
waitUntil(org.openqa.selenium.WebElement element,
com.google.common.base.Predicate<org.openqa.selenium.WebElement> condition,
long timeout,
TimeUnit unit)
Wait until condition is
true for element, up to the timeout specified
by unit. |
WebDriverPoller |
withDefaultTimeout(long timeout,
TimeUnit timeUnit) |
public static final long DEFAULT_TIMEOUT
public static final TimeUnit DEFAULT_TIMEOUT_UNIT
@Inject public WebDriverPoller(@Nonnull org.openqa.selenium.WebDriver webDriver)
@Nonnull public WebDriverPoller withDefaultTimeout(long timeout, @Nonnull TimeUnit timeUnit)
public void waitUntil(@Nonnull com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> condition)
WebDriverPoller.condition - condition that must evaluate to trueorg.openqa.selenium.TimeoutException - if the condition does not come true before the timeout expiresDEFAULT_TIMEOUT,
DEFAULT_TIMEOUT_UNITpublic void waitUntil(@Nonnull com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> condition, long timeoutInSeconds)
condition - condition that must evaluate to truetimeoutInSeconds - timeout in seconds to wait for condition to come trueorg.openqa.selenium.TimeoutException - if the condition does not come true before the timeout expirespublic void waitUntil(@Nonnull com.google.common.base.Function<org.openqa.selenium.WebDriver,Boolean> condition, long timeout, @Nonnull TimeUnit unit)
condition - condition that must evaluate to truetimeout - timeout to wait for condition to come trueunit - unit of the timeoutorg.openqa.selenium.TimeoutException - if the condition does not come true before the timeout expirespublic void waitUntil(@Nonnull org.openqa.selenium.WebElement element, @Nonnull com.google.common.base.Predicate<org.openqa.selenium.WebElement> condition)
true for element, up to the default timeout. The default
timeout depends on the arguments supplied while creating this WebDriverPoller.element - the element to examinecondition - condition that must evaluate to true, expressed by a Predicateorg.openqa.selenium.TimeoutException - if the condition does not come true before the timeout expiresDEFAULT_TIMEOUT,
DEFAULT_TIMEOUT_UNITpublic void waitUntil(@Nonnull org.openqa.selenium.WebElement element, @Nonnull com.google.common.base.Predicate<org.openqa.selenium.WebElement> condition, long timeoutInSeconds)
true for element, up to the timeoutInSeconds.element - the element to examinecondition - condition that must evaluate to true, expressed by a PredicatetimeoutInSeconds - timeout in seconds to wait for condition to come trueorg.openqa.selenium.TimeoutException - if the condition does not come true before the timeout expirespublic void waitUntil(@Nonnull org.openqa.selenium.WebElement element, @Nonnull com.google.common.base.Predicate<org.openqa.selenium.WebElement> condition, long timeout, TimeUnit unit)
true for element, up to the timeout specified
by unit.element - the element to examinecondition - condition that must evaluate to true, expressed by a Predicatetimeout - timeout to wait for condition to come trueunit - unit of the timeoutorg.openqa.selenium.TimeoutException - if the condition does not come true before the timeout expirespublic void waitUntil(@Nonnull org.openqa.selenium.WebElement element, @Nonnull org.hamcrest.Matcher<? super org.openqa.selenium.WebElement> condition)
true for element, up to the default timeout. The default
timeout depends on the arguments supplied while creating this WebDriverPoller.element - the element to examinecondition - condition that must evaluate to true, expressed by a Matcherorg.openqa.selenium.TimeoutException - if the condition does not come true before the timeout expiresDEFAULT_TIMEOUT,
DEFAULT_TIMEOUT_UNITpublic void waitUntil(@Nonnull org.openqa.selenium.WebElement element, @Nonnull org.hamcrest.Matcher<? super org.openqa.selenium.WebElement> condition, long timeoutInSeconds)
condition is true for element, up to the timeoutInSeconds.element - the element to examinecondition - condition that must evaluate to true, expressed by a MatchertimeoutInSeconds - timeout in seconds to wait for condition to come trueorg.openqa.selenium.TimeoutException - if the condition does not come true before the timeout expirespublic void waitUntil(@Nonnull org.openqa.selenium.WebElement element, @Nonnull org.hamcrest.Matcher<? super org.openqa.selenium.WebElement> condition, long timeout, TimeUnit unit)
true for element, up to the timeout specified
by unit.element - the element to examinecondition - condition that must evaluate to true, expressed by a Matchertimeout - timeout to wait for condition to come trueunit - unit of the timeoutorg.openqa.selenium.TimeoutException - if the condition does not come true before the timeout expiresCopyright © 2015 Atlassian. All rights reserved.