Infinite Scrolling
infinite_scroll Function
A common use case for Page Interactions is to scroll down pages that differ loading off-screen content until a user scrolls down to reveal it. Also known as "lazy loading", websites often do this to reduce page load times or as an alternative to pagination. Some examples include Facebook's newsfeed, Google News, and YouTube's search pages.
Page Interactions include a dedicated feature named infinite_scroll
designed specifically to scroll through lazy loading web pages. It's controlled using three parameters:
Parameter | Required | Description |
---|---|---|
| Required when | Integer | A time interval in milliseconds during which scrolling should be continuously attempted. |
| Optional | String | An identifier of the HTML element that displays the loading/spinner indicator. This helps identify when loading starts and ends. |
| Optional | Integer | The time delay, in ms, between scrolls. |
Scrolling is initiated as soon as the page load event is fired.
Infinite Scroll was designed to be used in one of two main methods:
Identifying the loading element
Where possible, it is recommended to use this method, as it allows for more accurate scrolling operation. Use the loading_selector
parameter to identify the loading indicator or spinner that is displayed while the page loads additional content, and refine the scrolling behavior with the delay_after_scroll
and duration
parameters.
Time-based scrolling
In cases where there is no loading indicator, the delay_after_scroll
and duration
parameters can be used to define and refine the scrolling action until it is well-timed for the particular webpage in question.
Example Request
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