wait_for
Pauses until a CSS selector matches or specified text appears in the active tab, polling every 100ms. Use after navigate, click, or scroll to handle asynchronously loaded content instead of sleeping.
Instructions
Wait until a CSS selector matches an element, or a text string appears in the page's visible text, in the session's active tab, polling every 100ms. Use it after navigate, click or scroll when content loads asynchronously, instead of sleeping. Pass selector or text; if both are given, only selector is checked. text is a case-sensitive substring of document.body.innerText, so text hidden with CSS doesn't count. 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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Text to wait for in document.body.innerText; case-sensitive substring match. | |
| 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. |