Skip to main content

Overview

Waiting commands allow you to pause execution until specific conditions are met, ensuring reliable automation.

wait

Wait for various conditions to be met.

Wait for Element

Wait for an element to be visible.
ParameterDescription
selectorElement selector to wait for
Examples:

Wait for Time

Wait for a specific duration.
ParameterDescription
millisecondsTime to wait in milliseconds
Examples:

Wait for Text

Wait for text to appear on the page.
OptionDescription
—text, -tText to wait for
Examples:

Wait for URL

Wait for URL to match a pattern.
OptionDescription
—url, -uURL pattern to wait for (glob pattern)
Examples:

Wait for Load State

Wait for page to reach a specific load state.
OptionDescription
—load, -lLoad state: load, domcontentloaded, networkidle
Load States:
StateDescription
loadPage load event fired
domcontentloadedDOM is fully loaded
networkidleNo network activity for 500ms
Examples:

Wait for Function

Wait for JavaScript expression to return true.
OptionDescription
—fn, -fJavaScript expression to evaluate
Examples:

Wait for Download

Wait for a file download to complete.
OptionDescription
—download, -dWait for download
pathOptional: Save download to specific path
—timeoutOptional: Download timeout in milliseconds
Examples:

Workflow Examples

Wait After Navigation

Wait for Dynamic Content

Wait for Form Submission

Wait for AJAX Request

Download File

Chained Waits

Timeout Handling

The default timeout for wait commands is 25 seconds. Override with the AGENT_BROWSER_DEFAULT_TIMEOUT environment variable:

Best Practices

Use Network Idle for SPAs

Wait for Specific Elements

Combine Waits