Scroll to

scroll_to Function

The scroll_to function scrolls the page to bring a specific element into view. This is useful for interacting with elements that are not initially visible on the page, such as loading more content as you scroll down.

Parameter
Required
Description

selector

Required when scroll_to is being used

String | The selector for the desired element to scroll to

visible

Optional

Bool | when true, the request will wait for the element to be present in the DOM and to be visible, i.e. to not have display: none or visibility: hidden CSS properties.

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": [{
            "scroll_to": {
                "selector": "input[name='\''Organic'\'']",
                "visible": false
        }
    }]
}'

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