|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openqa.selenium.support.ui.WebDriverWait
public class WebDriverWait
An implementation of the Wait interface that makes use of WebDriver. The
expected usage is in conjunction with the ExpectedCondition
interface.
Because waiting for elements to appear on a page is such a common use-case, this class will silently swallow NotFoundException whilst waiting.
Constructor Summary | |
---|---|
protected |
WebDriverWait(Clock clock,
WebDriver driver,
long timeOutInSeconds,
long sleepTimeOut)
|
|
WebDriverWait(WebDriver driver,
long timeOutInSeconds)
|
Method Summary | ||
---|---|---|
protected void |
throwTimeoutException(java.lang.String message,
java.lang.Exception lastException)
Override this method to throw an exception that is idiomatic for a given test infrastructure. |
|
|
until(com.google.common.base.Function<WebDriver,T> isTrue)
Implementations should wait until the condition evaluates to a value that is neither null nor false. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WebDriverWait(WebDriver driver, long timeOutInSeconds)
driver
- The WebDriver instance to pass to the expected conditionstimeOutInSeconds
- The timeout in seconds when an expectation is
calledprotected WebDriverWait(Clock clock, WebDriver driver, long timeOutInSeconds, long sleepTimeOut)
clock
- The clock to use when measuring the timeoutdriver
- The WebDriver instance to pass to the expected conditionstimeOutInSeconds
- The timeout in seconds when an expectation issleepTimeOut
- The timeout used whilst sleeping. Defaults to 500ms
calledMethod Detail |
---|
public <T> T until(com.google.common.base.Function<WebDriver,T> isTrue)
If the condition does not become true within a certain time (as defined
by the implementing class), this method will throw a non-specified
Throwable
. This is so that an implementor may throw whatever is
idiomatic for a given test infrastructure (e.g. JUnit4 would throw AssertionError
.
until
in interface Wait<WebDriver>
T
- the return type of the method, which must not be VoidisTrue
- the parameter to pass to the ExpectedCondition
protected void throwTimeoutException(java.lang.String message, java.lang.Exception lastException)
AssertionError
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |