TOPIC 09/4018 MINNOT STARTED

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 .

  1. Name the condition
  2. Ask again briefly
  3. Stop when true
  4. Fail clearly at the limit
Wait for the thing, with a limit

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
Knocking at a doorAsking again whether the page is ready
Stopping when it opensStopping as soon as the condition is true
Giving up after a whileThe time limit
Standing there all dayA 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.

What each part of the trick stands for
In the trickWhat it stands for
SleepA fixed long sleep
KnockAsking again whether the page is ready
LimitThe 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
  1. 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)

    Per the search excerpt, an implicit wait is a session-wide setting for element lookups, an explicit wait polls for one named condition, and mixing the two can cause unpredictable wait times. · Checked 2026-10-18

    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.

  2. 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)

    Names isolation, asynchronous behaviour and quarantine as ways to handle non-deterministic tests, and advises against bare sleeps in favour of callbacks or polling with a timeout. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-10-18

    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.

  3. 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)

    Says Playwright runs actionability checks (visible, stable, enabled, receives events) before an action and fails with a timeout error if they do not pass in time. Vendor documentation. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-11-06

    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.

  4. 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)

    Recommends user-facing locators such as role-based ones over Cascading Style Sheets (CSS) or XPath, web-first assertions that retry, and avoiding fixed waits. Vendor documentation. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-10-18

    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).

  5. 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)

    Defines the HyperText Transfer Protocol (HTTP) command set of the WebDriver protocol. New Session is POST /session. Find Element is POST /session/{session id}/element. Element Click is POST on the element click path. Error codes include element not interactable and element click intercepted. Practitioner or vendor guidance, not a standard unless stated. · Checked 2026-10-18

    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.

  6. 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.

    FluentWait sets a timeout, a polling interval and exception types to ignore while waiting. · Checked 2026-10-19

    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.

  7. 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.

    An intercepted request can be given an alias and waited on with cy.wait to read its request and response. · Checked 2026-10-19

    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.

  8. 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)

    Says Cypress commands are queued, queries retry as a chain while commands such as click run once, and an assertion mid-chain is a retry boundary. Vendor documentation. Practitioner or vendor guidance, not a standard unless stated. · Checked 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.