Selenium · Browser automation foundations
What happens when you mix implicit and explicit waits?
Short answer
Implicit waits apply a fixed polling timeout to every findElement call. Explicit waits poll a condition on top of that. Mixing them produces unpredictable, compounding delays and is explicitly discouraged by the Selenium documentation.
An implicit wait is set once on the driver and affects every element lookup. An explicit wait is scoped to one condition and one call site. They solve different problems, and combining them makes timeout behaviour hard to reason about because each lookup can consume the implicit timeout before the explicit condition is even evaluated.
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(5));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("result")));- Implicit wait is global and is applied inside every findElement and findElements
- Explicit wait is local and evaluates a named condition on a schedule
- The two timeouts do not coordinate, so actual delay is hard to predict
- A long implicit wait also slows down negative assertions such as expecting no element
- The recommended approach is zero implicit wait and explicit waits at the points that need synchronisation
Negative checks are a common trap. If a test expects a deleted row to disappear, an implicit wait makes findElements block for the full timeout before returning empty, even though the UI settled quickly. Explicit invisibility or size conditions express the intent and fail with a useful message.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Why does Selenium discourage mixing the two?
- 2How does an implicit wait affect negative assertions?
- 3What would you do with a legacy suite that relies on implicit waits?
- 4Does an explicit wait replace implicit waiting for page load?
Say it in the interview
Implicit waits are global and apply to every element lookup, while explicit waits poll a specific condition. When both are set, a lookup can block for the implicit timeout inside the explicit wait, so the real delay is unpredictable. That also makes negative assertions slow. I set implicit wait to zero and use explicit waits where the application actually synchronises, then remove legacy implicit waits gradually.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Selenium mock interview and get scored feedback on depth, clarity and confidence.