QuickDevGuide

Home › Selenium Automation (Java)

Waits: Implicit, Explicit & Fluent — Selenium Automation (Java)

Modern pages load asynchronously. Synchronise on conditions, never on fixed sleeps. Wait Scope Use Thread.sleep fixed delay ❌ slow and still flaky Implicit every findElement polls up to N s simple, but hides problems and mixes badly with explicit waits Explicit (WebDriverWait) one condition ✅ recommended Fluent (FluentWait) explicit + custom polling / ignored exceptions special cases Useful ExpectedConditions visibilityOfElementLocated, elementToBeClickable, invisibilityOfElementLocated (spinners), textToBePresentInElementLocated, urlContains, numberOfElementsToBe, frameToBeAvailableAndSwitchToIt, alertIsPresent, stalenessOf. Don't mix implicit and explicit waits — timeouts can multiply unpredictably. Set implicit wait to 0 and use explicit waits everywhere.

Key Takeaways