wait_for
Waits until a CSS selector matches, specified text appears, or a JavaScript expression is truthy; use after navigate, click, or scroll when content loads asynchronously.
Instructions
Wait until a CSS selector matches an element, a text string appears in the page's visible text, or a JavaScript expression is truthy, in the session's active tab, polling every 100ms; or, with only ms, just pause. Use it after navigate, click or scroll when content loads asynchronously. Pass one of selector, text or expression; selector wins if several are given. ms alone is a plain pause for hosts with no timer of their own. text is a case-sensitive substring of document.body.innerText, so text hidden with CSS doesn't count; it is looked for in frames from other sites too. It reads the page without changing it. Returns which selector or text matched. Fails with a timeout error if nothing matches within timeout, or if neither argument is given.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sessionId": "<sessionId>"
},
"name": "wait_for"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ms | No | With no selector, text or expression: just wait this many milliseconds (at most 25000), for hosts without timers. | |
| text | No | Text to wait for in document.body.innerText; case-sensitive substring match. | |
| frame | No | With `expression`: run it in the frame whose URL contains this (as evaluate's `frame`). | |
| timeout | No | Milliseconds to wait before failing. Default 10000. | |
| selector | No | CSS selector to wait for. | |
| sessionId | Yes | The id returned by open_browser_session. Errors if no open session has it. | |
| expression | No | JavaScript to poll until its value is truthy, run like evaluate (e.g. `window.dataLayer.length > 3`). |