What is the difference between implicit waits, explicit waits and auto-waiting?
What the interviewer wants to hear
- Implicit wait: global timeout for finding elements in Selenium
- Explicit wait: wait for a specific condition on a specific element
- Auto-waiting: frameworks like Playwright wait for actionability automatically
- Avoid fixed sleeps and avoid mixing implicit and explicit waits
Model answer
In Selenium, an implicit wait sets a global timeout: whenever findElement cannot find an element, it keeps trying up to that time. It only helps with element presence, not with conditions like "clickable" or "text changed". An explicit wait uses WebDriverWait with a specific condition, like elementToBeClickable or visibilityOf, for one element, which is more precise. The Selenium docs advise not to mix the two, because combined timeouts become unpredictable. Modern tools like Playwright auto-wait: before clicking, they check the element is attached, visible, stable, enabled and receives events, and web-first assertions like toHaveText keep retrying until timeout. In all tools I avoid fixed sleeps, because they make tests slow when the app is fast and still flaky when it is slow.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Automation Test Engineer questions
- Why do teams automate tests, and what should not be automated?
- Explain the Page Object Model and its benefits. Are there any downsides?
- How do you run automated tests in a CI pipeline?
- When would you write an API test instead of a UI test?
- How do you choose locators for UI tests, and what makes a locator fragile?
- Explain the test pyramid. How does it guide what you automate?
- When you automate tests for a REST API endpoint, what do you check?
- What makes an automated test good?
- Compare Selenium and Playwright. When would you choose each?