wait_for
Pause until the page is ready: wait for text, a selector, a URL pattern, or a load state before reading or clicking, instead of sleeping.
Instructions
Wait until the page is ready, instead of sleeping or clicking to pass time.
Give exactly one condition:
text: the phrase is in the page's visible text — whatread_pagereturns. Whitespace does not matter, case does.state="hidden"waits for it to be gone instead (a "Loading..." message).selector: an element matching it (CSS or Playwrighttext=) reachesstate:visible(default),hidden,attachedordetached.url: the tab's URL matches. A glob over the whole URL, so use**/checkout**orhttps://site.example/cart*, notcheckout.load_state:load,domcontentloadedornetworkidle.
Waits up to timeout_ms (default 10000, never more than 30000) and
returns {"status": "ok", "waited_ms"}. Running out of time is an
answer, not a failure: {"status": "timeout", "waited_ms", "last_seen"},
where last_seen is a short excerpt of the page text (the URL for a
url wait) so you can see why. Bad arguments return error.
Use it after navigate or an action when the page draws content late: a
page that renders 300ms after load looks empty to read_page until this
returns. It only reads, so it needs no approval and works while the user
has taken over.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | ||
| text | No | ||
| state | No | visible | |
| selector | No | ||
| load_state | No | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||