session_wait
Waits until a CSS selector or JavaScript condition becomes true, while keeping the page's event loop active, so you can act on async content without arbitrary sleep delays.
Instructions
Wait until a CSS selector matches or a JS predicate turns truthy, with a timeout. The page's event loop keeps running while waiting (fetches, timers, promise chains progress), so this replaces blind sleeps for async content: navigate, session_wait for '.price-card', then click/read. Returns {matched, elapsed_ms, detail:{tag,text} or the predicate value}; errors with timeout ... naming the selector/predicate on expiry. Exactly one of selector/predicate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | No | CSS selector to wait for (e.g. ".price-card") | |
| predicate | No | JS expression polled until truthy (e.g. "document.querySelectorAll('.card').length >= 3") | |
| session_id | Yes | Session ID | |
| timeout_ms | No | Give up after this many milliseconds (default: 10000, max: 120000) |