Creating Custom Waits so That an Element's Attribute Values Can Be Updated

When running a test, the attribute of one or more elements can be changed at runtime. For instance, the text of a label can be modified with a new message, or a button can be enabled once certain steps have been completed. In such cases, a custom wait can be written on the attribute value of any of those elements.

This custom wait will wait 5 seconds before checking if the "disabled" attribute of the runTestButton element has changed to "false":

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

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