session_wait
Wait for async content to appear by polling a CSS selector or JS predicate until truthy, with a timeout. Replaces blind sleeps for dynamic pages.
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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"session_id": "<session_id>"
},
"name": "session_wait"
}
}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) |