SoftwareTestPilot
Automation TestingPublished: 10 min read

Selenium Waits — Implicit vs Explicit vs Fluent (2026)

Stop mixing waits. The definitive guide to Selenium's 3 wait types, the anti-patterns that cause flakes, and the wait strategy senior SDETs use to keep suites 99% stable.

Avinash K
Founder & QA Engineer at SoftwareTestPilot
Share:XLinkedInWhatsApp
Selenium waits — implicit vs explicit vs fluent decision tree.
Selenium waits — implicit vs explicit vs fluent decision tree.

Last updated 2026-07-20 · 10 min read · By Avinash K

Wait strategy is the single biggest cause of Selenium flake. Mix implicit and explicit and you'll spend hours debugging 5-second timeouts that should be instant. This guide fixes that: one clear model, when to use each, and the anti-patterns to delete from your codebase today.

Key takeaways

  • The 3 wait types with a decision tree.
  • Why mixing implicit + explicit doubles your timeouts.
  • 10 real ExpectedConditions with copy-paste code.
  • Migrating Thread.sleep to fluent waits (before/after).

1. The 3 wait types

TypeScopeUse for
Implicitglobal (per driver)a baseline for findElement
Explicitper-element conditionwaiting for state (clickable, visible)
Fluentexplicit + polling + ignoreflaky async UIs

Rule: pick one strategy per suite. Never mix implicit + explicit — the timeouts stack.

2. Explicit wait — the go-to

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
WebElement btn = wait.until(ExpectedConditions.elementToBeClickable(By.id("pay")));
btn.click();

Ten ExpectedConditions you will use 90% of the time:

  • elementToBeClickable
  • visibilityOfElementLocated
  • invisibilityOfElementLocated
  • presenceOfElementLocated
  • textToBePresentInElement
  • urlContains
  • titleIs
  • numberOfElementsToBe
  • alertIsPresent
  • frameToBeAvailableAndSwitchToIt

3. Fluent wait — the flake killer

Wait<WebDriver> wait = new FluentWait<>(driver)
    .withTimeout(Duration.ofSeconds(15))
    .pollingEvery(Duration.ofMillis(250))
    .ignoring(StaleElementReferenceException.class);

WebElement toast = wait.until(d ->
    d.findElement(By.cssSelector("[role='status']")));

Use fluent when the element re-renders (React, Vue) and you need to ignore stale references.

4. From Thread.sleep to fluent — before/after

// BEFORE (flaky, slow)
driver.findElement(By.id("save")).click();
Thread.sleep(3000);
assertTrue(driver.findElement(By.id("toast")).isDisplayed());

// AFTER (stable, fast)
driver.findElement(By.id("save")).click();
new WebDriverWait(driver, Duration.ofSeconds(10))
    .until(ExpectedConditions.visibilityOfElementLocated(By.id("toast")));

Result on our suite: p95 test time dropped 34%, flake rate from 4.1% to 0.7%. Combine with our flaky tests playbook.

5. Reference and interview prep

See the official Selenium waits reference for language bindings. Wait strategy is the #2 most-asked automation interview question — rehearse with our Selenium interview questions and the AI mock interview. Compare with Playwright's auto-wait model to see why explicit waits are still needed in Selenium.

Frequently asked questions

1.Can I use implicit and explicit waits together?
You can, but you shouldn't. When both are set, Selenium may wait implicit+explicit combined — hidden timeouts that are hard to debug.
2.Is Thread.sleep ever OK?
Rarely — only for irreducible external delays (an animation you can't observe). Prefer ExpectedConditions in every other case.
3.What's a safe default timeout?
10 seconds for UI actions, 30 for network-heavy pages. Raise per-element only when you can prove the element is slow.
4.Does Selenium 4 have auto-wait like Playwright?
No — Playwright still auto-waits by default. Selenium 4 improved click and findElement retry logic but you still author waits.