Skip to content

Waiting ​

wait_for_selector ​

Wait until an element reaches a state.

Parameters:

NameTypeRequiredDescription
selectorstringYesCSS selector, XPath or snapshot ref
statestringNovisible (default), hidden, attached, detached
timeoutnumberNoMaximum seconds to wait (default: 10)
session_idstringYesSession ID to use

Example Response:

json
{ "found": true, "state": "visible", "selector": "#results", "elapsed_ms": 640 }

On timeout the tool fails with Timed out after 10s waiting for #results to be visible.

wait_for_text ​

Wait until text is visible on the page (optionally inside an element).

Parameters:

NameTypeRequiredDescription
textstringYesText to wait for
selectorstringNoCSS selector of the element to search in (default: body)
exactbooleanNoMatch the whole text exactly (default: substring)
timeoutnumberNoMaximum seconds to wait (default: 10)
session_idstringYesSession ID to use

wait_for_network_idle ​

Wait until the page has no pending requests (after a click that triggers XHR/fetch, for instance).

Parameters:

NameTypeRequiredDescription
timeoutnumberNoMaximum seconds to wait (default: 30)
connectionsintegerNoPending connections tolerated as idle (default: 0)
session_idstringYesSession ID to use

Example Response:

json
{ "idle": true, "elapsed_ms": 120, "url": "https://example.com/results" }

Released under the MIT License.