All subjects

Web Automation · Interview subject

Selenium Interview Questions

Waits, locators, stale elements, Shadow DOM, windows and Grid.

57 questions

Quick interview answer

Implicit wait is a global polling timeout on element lookup; explicit wait waits for a specific condition on a specific element; fluent wait is an explicit wait with a custom polling interval and ignored exceptions.

Detailed explanation

Implicit wait is set once on the driver and applies to every findElement call — it cannot wait for state (clickable, visible text). Explicit wait (WebDriverWait + ExpectedConditions) targets one element and one condition, so it is precise and self-documenting. Fluent wait exposes pollingEvery() and ignoring(), useful for slow AJAX widgets. Never mix implicit and explicit waits: the resulting timeout is unpredictable and can multiply.

java
1// Explicit wait — preferred
2WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(15));
3WebElement pay = wait.until(ExpectedConditions.elementToBeClickable(By.id("pay")));
4
5// Fluent wait — slow, chatty widgets
6Wait<WebDriver> fluent = new FluentWait<>(driver)
7 .withTimeout(Duration.ofSeconds(30))
8 .pollingEvery(Duration.ofMillis(500))
9 .ignoring(NoSuchElementException.class, StaleElementReferenceException.class);

Real-world example

On a payments page the Pay button renders instantly but is disabled until the card token returns. Implicit wait passes, the click silently does nothing — explicit elementToBeClickable fixes it.

Interview tip

Say out loud: 'I set implicit wait to ZERO in my framework and use explicit waits only.' Interviewers love that line.

Next subjectTestNG