Setup

bl wait

Wait for an element, URL, text, page load, or JS condition

Wait for an element, URL, text, page load, or JS condition

Usage

bl wait [selector] [OPTIONS]
bl wait <command>

Arguments

ArgumentDescription
[selector]CSS selector of the element to wait for

Options

OptionDescription
--state <value>State to wait for: attached, visible, hidden (default attached)
--timeout <value>Timeout in milliseconds (default 30000)
--headlessHide browser window (visible by default)
--jsonOutput as JSON
--session <value>Run this command in the named session (env: BL_SESSION; default: "default")

Global options

OptionDescription
-v, --verboseEnable debug logging

Examples

bl wait "div.loaded"
# Wait for element to exist in DOM

bl wait "div.loaded" --state visible
# Wait for element to be visible

bl wait "div.spinner" --state hidden --timeout 5000
# Wait for spinner to disappear

bl wait url

Wait until the page URL contains a substring

Usage

bl wait url <pattern> [OPTIONS]

Arguments

ArgumentDescription
&lt;pattern&gt;Substring the URL must contain

Options

OptionDescription
--timeout <value>Timeout in milliseconds (default 30000)
--headlessHide browser window (visible by default)
--jsonOutput as JSON
--session <value>Run this command in the named session (env: BL_SESSION; default: "default")

Global options

OptionDescription
-v, --verboseEnable debug logging

Examples

bl wait url "/dashboard"
# Wait until URL contains "/dashboard"

bl wait url "success" --timeout 10000
# Wait up to 10 seconds

bl wait text

Wait until text appears on the page

Usage

bl wait text <text> [OPTIONS]

Arguments

ArgumentDescription
&lt;text&gt;Text to wait for on the page

Options

OptionDescription
--timeout <value>Timeout in milliseconds (default 30000)
--headlessHide browser window (visible by default)
--jsonOutput as JSON
--session <value>Run this command in the named session (env: BL_SESSION; default: "default")

Global options

OptionDescription
-v, --verboseEnable debug logging

Examples

bl wait text "Welcome"
# Waits until "Welcome" appears on the page

bl wait text "Success" --timeout 10000
# Wait with custom timeout (10 seconds)

bl wait load

Wait until the page is fully loaded

Usage

bl wait load [OPTIONS]

Options

OptionDescription
--timeout <value>Timeout in milliseconds (default 30000)
--headlessHide browser window (visible by default)
--jsonOutput as JSON
--session <value>Run this command in the named session (env: BL_SESSION; default: "default")

Global options

OptionDescription
-v, --verboseEnable debug logging

Examples

bl wait load
# Wait until document.readyState is "complete"

bl wait load --timeout 10000
# Wait up to 10 seconds

bl wait fn

Wait until a JS expression returns truthy

Usage

bl wait fn <expression> [OPTIONS]

Arguments

ArgumentDescription
&lt;expression&gt;JS expression to evaluate until truthy

Options

OptionDescription
--timeout <value>Timeout in milliseconds (default 30000)
--headlessHide browser window (visible by default)
--jsonOutput as JSON
--session <value>Run this command in the named session (env: BL_SESSION; default: "default")

Global options

OptionDescription
-v, --verboseEnable debug logging

Examples

bl wait fn "document.readyState === 'complete'"
# Wait for page to be fully loaded

bl wait fn "window.ready === true" --timeout 10000
# Wait for custom condition with timeout

On this page