wait_for
Wait for a specified condition like element appearance, URL match, or JavaScript predicate to be true on a browser tab, avoiding fixed delays.
Instructions
Wait for a condition. Strongly prefer 'function', 'selector', or 'url_match' — they return as soon as the condition is true (1 round-trip). Use 'timeout' only as a last resort: it blocks for a fixed duration and returns no information, forcing you to poll with another tool afterwards.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tabId | Yes | Tab ID to wait on | |
| type | Yes | Condition. PREFER: 'selector' (element appears), 'selector_hidden', 'function' (custom JS predicate, e.g. value="document.querySelectorAll('.error').length>0"), 'url_match', 'navigation'. AVOID 'timeout' — it just sleeps. | |
| value | No | Selector, JS function, URL pattern, or ms | |
| timeout | No | Max wait in ms. Default: 30000 | |
| visible | No | Require visibility (selector). Default: false | |
| pollIntervalMs | No | Function mode only: predicate polling interval in ms for main-frame evaluation. Default 200, min 50, max 5000. |