Skip to main content

Waiting

Most tools wait on their own: after an action, the server waits for triggered navigations and network activity to settle before returning a snapshot. Use browser_wait_for when you need to wait for something specific.

browser_wait_for

Wait for text to appear or disappear, or for a specified time to pass. At least one of time, text or textGone must be provided; when several are given, the time elapses first, then textGone, then text.

ParameterTypeRequiredDescription
timenumbernoThe time to wait in seconds (capped at 30)
textstringnoThe text to wait for
textGonestringnoThe text to wait for to disappear

Wait for text to appear

→ browser_wait_for { text: "Upload complete" }
Waited for Upload complete

Wait for text to disappear

→ browser_wait_for { textGone: "Loading..." }
Waited for Loading...

Wait a fixed duration

→ browser_wait_for { time: 3 }
Waited for 3

Workflow: waiting for async operations

You: Click the upload button and wait for it to finish.

→ browser_click { target: "e9" }

- progressbar "Uploading..." [ref=e12]

→ browser_wait_for { textGone: "Uploading..." }

- text: Upload complete! File saved.
- link "View file" [ref=e15]

More complex conditions

For waits that text matching can't express — a CSS selector, a JavaScript predicate, a specific response — use browser_run_code_unsafe:

→ browser_run_code_unsafe {
code: "async (page) => { await page.waitForSelector('.data-loaded'); }"
}

→ browser_run_code_unsafe {
code: "async (page) => { await page.waitForResponse(r => r.url().includes('/api/items') && r.ok()); }"
}

Action and navigation timeouts are configurable with --timeout-action (5000ms by default) and --timeout-navigation (60000ms by default).