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();
}
});