wait_for
Wait for a condition (element, text, JS expression, navigation, or network idle). Returns found: false with a reason on timeout instead of raising; read-only.
Instructions
Block until a condition holds: element (selector in the DOM), function (JS expression turns truthy; needs the "Allow user scripts" toggle), navigation (mode=spa for client-side route changes), network_idle. Polls until timeout — 10s for element and function, 15s for navigation and network_idle — then returns found: false with a reason instead of raising, so a caller that ignores the result silently proceeds as if the wait had succeeded. Read-only: waiting changes nothing on the page.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | spa = pushState/popstate/hashchange | load |
| text | No | Literal text to wait for (condition=text), matched case-insensitively | |
| tab_id | No | Target tab; omitted = last tab navigated in this session, else the active one | |
| idle_ms | No | Quiet period ms (network_idle) | |
| timeout | No | Max ms (default 10000; 15000 navigation/network_idle) | |
| visible | No | Element must also be visible | |
| frame_id | No | Target iframe id from get_frames; omitted = main frame | |
| interval | No | Poll ms, min 50 | |
| selector | No | condition=element; with condition=text it narrows the search to that subtree | |
| condition | Yes | element and text need selector or text; function needs expression | |
| expression | No | JS expression (condition=function) |