What are wait strategies in browser automation?
A wait strategy is how your script decides the page is ready. Get it wrong and automation becomes flaky: it works on your machine, fails in CI, fails on one page in fifty, and the failures never reproduce when you are watching.
The three kinds
Fixed sleep. Wait three seconds and hope. Always costs its full duration even when the page was ready instantly, and still fires early when the site is slow. It fails in both directions at once, which is why it is the worst option despite being the most common.
Explicit wait for a condition. Wait until a specific element exists, is visible, or is interactive. Returns as soon as the condition is met, and fails loudly with a clear message when it never is. This is the right default.
Implicit or automatic waiting. The framework waits on your behalf before each action. Playwright does this by default, checking that an element is attached, visible, stable and enabled before clicking. It removes most of the boilerplate and most of the flakiness.
Choosing what to wait for
The condition matters as much as the mechanism, and the common mistake is waiting for the wrong thing.
Waiting for the page load event is too early on any client-rendered site, because the event fires before scripts have built the content. Waiting for network idle is closer but unreliable on pages with polling, analytics beacons or open websockets, which never go idle.
The most dependable condition is the presence of the data itself: wait for the element containing the value you came for. If that element exists, the page is ready by definition, whatever the network is doing.
For content appearing after an interaction, wait for the change rather than the action. After clicking "load more", wait for the item count to increase rather than sleeping and hoping.
The pattern for infinite scroll
Scroll, wait for the item count to grow, repeat, and stop when it stops growing or a limit is reached. Sleeping a fixed amount between scrolls either wastes time or misses items, and adding a maximum iteration count keeps a page that loads forever from running forever.
Where Zenrows fits
On a Fetch request, wait_for takes a CSS selector and returns as soon as it appears, which is the explicit-wait approach without running a browser yourself. wait is the fixed-delay fallback for the cases where no selector marks completion, and it is worth treating as a last resort for the reasons above.
For sequences rather than a single wait, JavaScript instructions accept an ordered list of clicks, waits and selector waits on one request, so a multi-step interaction does not require a full Browser Sessions setup.
Go deeper on the blog
In the docs
Last updated: Aug 16, 2026