Creating Custom Waits for an Element's Visibility

Not only can the values of attributes of an element be modified during runtime. A button, for example, can also be set to disappear after certain steps have been completed. In such cases, a custom wait can be written based on the visibility of the elements.

This custom wait will wait 5 seconds before checking as we did the "runTestButton" element is visible or not:

Boolean active = new WebDriverWait(driver, 5)
.until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
return d.findElement(By.id("runTestButton")).
isDisplayed();
}
});
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.187.233