Wait for Selector

wait_for Function

The wait_for function pauses the operation until a specific element, identified by a CSS selector, is present on the page. This ensures that the desired element is loaded before performing subsequent actions, which is crucial for interacting with dynamic content.

ParameterRequiredDescription

selectors

Required when wait_for is being used

String | Wait until the listed selector(s) have loaded.

timeout

Optional

Integer | Controls the time to allow until a selector is loaded in ms.

Example Request

curl -X POST 'https://api.webit.live/api/v1/realtime/web' \
--header 'Authorization: Basic <credential string>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://www.example.com",
    "render": true,
    "render_flow": [{
            "wait_for": {
                "selectors": [”body",”id”],
                "timeout": 2000
        }
    }]
}'

Like all Page Interactions, infinite scrolling is capped by the global 120-second session timeout, and will be terminated if this limit is reached.

Last updated