Waits and timing in automated checks
Make a check wait for the right thing, not for a fixed time, and tell explicit, implicit and automatic waits apart.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: knocking at a door. You knock once on the door and wait. If nobody comes in a moment, you wait a little longer. You do not shout every second, and you do not stand there all day. You stop when the door opens or when you have waited long enough.
Daily List is a to-do list app. Lily taps Save and a message, Saved, appears a moment later. How long a moment is changes each time. Tom's check looks for the message right away and fails.
A quick fix is to make the check pause for a full second. That works on most days. On a slow day it fails, and on every day it wastes time.
A better fix is to knock and wait. The check asks again and again whether the message is there and stops as soon as it is. It gives up only after a time limit.
The picture has limits. A person at a door can hear footsteps. can only look at the page, so it must say what it is waiting for.
(SYNTHETIC / TRAINING ONLY: Daily List and every person named in this lesson are invented.)
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Making wait for the right thing with a limit, not for a .
- Name the condition
- Ask again briefly
- Stop when true
- Fail clearly at the limit
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| Knocking at a door | Asking again whether the page is ready |
| Stopping when it opens | Stopping as soon as the condition is true |
| Giving up after a while | The time limit |
| Standing there all day | A fixed long sleep |
WHERE THIS PICTURE STOPS
- A person can hear footsteps. A check only sees the page.
- A door opens once. A page can change again.
- A person is not in a hurry. A pipeline is.
HOOK
Wait for the thing, with a limit.
REMEMBER IT THIS WAY
A contrast: two neighbours told apart by one test.
A costs the full second even on good days. Knocking stops as soon as Saved appears, and gives up at a limit.
| In the trick | What it stands for |
|---|---|
| Sleep | A fixed long sleep |
| Knock | Asking again whether the page is ready |
| Limit | The time limit |
TELL A FRIEND
Knock, wait for the door to open, and give up after a while. asks again whether the page is ready and gives up at a limit.
OFTEN MIXED UP WITH Locators: finding an element with CSS selectors and XPath. The locator lesson finds the element. This lesson makes sure it is ready to be used.
PRACTISE AND KEEP
Sources for this topic — 8 sources
- Market practice
Waiting strategies (Selenium documentation) ↗ — Selenium project · Do not mix implicit and explicit waits; an implicit wait polls for a single element until found or the timeout ends; the default implicit wait is zero (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Eradicating Non-Determinism in Tests (Martin Fowler) ↗ — Martin Fowler · Never use bare sleeps to wait for asynchronous responses; use a callback or polling, and still keep a timeout (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Auto-waiting (Playwright documentation) ↗ — Microsoft (Playwright) · Playwright runs actionability checks before each action and fails with a timeout error if they do not pass in time (search excerpt, page not opened)
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
Best practices (Playwright documentation) ↗ — Microsoft (Playwright) · Avoid fixed waits; waitForTimeout is for debugging and tests that use it become flaky (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. A second search on 2026-10-20 returned this page for its title and matched the described content; the page was still not opened (search excerpt, page not opened).
- Market practice
WebDriver, World Wide Web Consortium Recommendation ↗ — World Wide Web Consortium · The WebDriver standard defines timeouts for the session (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
FluentWait (Selenium Java API) ↗ — Selenium project · r8a-selenium-fluentwait-api (timeout, polling interval, ignored exceptions); selenium-waiting-strategies. Search excerpt, page not opened.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
cy.intercept() ↗ — Cypress · r8a-cypress-intercept (cy.intercept with an alias, then cy.wait on the alias yields the request and reply). Search excerpt, page not opened.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Retry-ability in Cypress (Cypress documentation) ↗ — Cypress · A passed mid-chain assertion can preserve a stale subject; requery after the boundary when the page may replace elements. (primary page opened and read, 2026-10-22)
Opened and read on 2026-10-22. The sections on queries, assertions as retry boundaries, and splitting chains explain why a passed assertion can keep a subject that the app later replaces. A new query starts from the page again. A should callback can keep related read-only checks together. This is vendor documentation, not a standard. No edition number is stated.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.