wait_for
Waits for a web page to be ready: checks for a CSS selector or visible text, or waits until DOM mutations settle. Supports visible/present/gone states, minimum wait time, and settlement toggling.
Instructions
Wait until the page is ready. By default waits for BOTH your condition and page settlement (DOM mutation rate decayed). Provide selector (CSS) or text (visible substring) with state visible|present|gone, or call with neither to wait for settlement alone. min_ms sets a minimum elapsed time; settle:false gates on the condition only. Returns elapsed_ms, settle diagnostics, and the matched element's ref for follow-up clicks. Times out with an error naming what WAS on the page.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | A visible-text substring to wait for (matched against accessible names and nearby text). Provide at most one of selector or text. | |
| state | No | visible (default): the selector/text is present and rendered. present: in the DOM. gone: absent or hidden. settled: wait for the page to stop churning; valid only with no selector/text. | |
| tabId | Yes | Tab ID to wait on. Must be a tab in the current group. Use tabs_context first if you don't have a valid tab ID. | |
| min_ms | No | Minimum elapsed time before returning, even if the condition and settlement are already satisfied. Default 0. | |
| settle | No | Whether to also wait for page settlement (DOM mutation rate decay). Default true; set false to gate on the condition alone. | |
| selector | No | A CSS selector to wait for. Provide at most one of selector or text. With state visible (default) the element must be present AND rendered; present only requires it be in the DOM; gone waits for its absence. | |
| timeout_ms | No | Maximum wait in milliseconds. Default 10000, hard cap 30000. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | No | ||
| found | Yes | ||
| settled | No | ||
| elapsed_ms | Yes | ||
| final_rate | No | ||
| provenance | No | ||
| peak_mutations | No |