WaitEngine
WaitEngine provides fluent explicit waits. It is pre-configured with the timeout from selenium-boot.yml (timeouts.explicit) and is available in every BasePage via getWait().
Available methods
Element visibility
getWait().waitForVisible(By.id("modal"));
getWait().waitForInvisible(By.cssSelector(".spinner")); // wait for loaders to disappear
Clickability
getWait().waitForClickable(By.id("submit"));
Text content
getWait().waitForText(By.cssSelector("h1"), "Welcome back");
Attribute value
getWait().waitForAttributeContains(By.id("status"), "class", "active");
DOM staleness
WebElement old = driver.findElement(By.id("row-1"));
getWait().waitForStaleness(old); // wait for DOM replacement / AJAX reload
Page load
getWait().waitForPageLoad(); // waits until document.readyState === "complete"
Custom condition
// Escape hatch — pass any ExpectedCondition
getWait().wait(ExpectedConditions.numberOfWindowsToBe(2));
Timeout override
Use a custom timeout for a single wait without changing the global config:
getWait(30).waitForVisible(By.id("slow-element")); // 30-second timeout
Configuration
selenium-boot.yml
timeouts:
explicit: 10 # seconds — default for all WaitEngine calls
pageLoad: 30 # seconds — browser page load timeout
Anti-patterns to avoid
// ❌ never do this
Thread.sleep(3000);
// ✅ do this instead
getWait().waitForVisible(By.id("result"));
// ❌ raw WebDriverWait — bypasses framework timeout config
new WebDriverWait(driver, Duration.ofSeconds(10))
.until(ExpectedConditions.visibilityOf(...));
// ✅ use getWait() — reads timeout from config
getWait().waitForVisible(By.id("result"));