Scroll
Type: scroll
Request that the browser scrolls to a certain point on the page or, in the case of pages with infinite scrolling, scrolls for a particular amount of time.
Parameters
percentage
integer
The percentage the page should scroll up or down (+/-) Range: [-100 - 0 - 100] Default: 100 (% - scroll to bottom)
wait_time
integer
max_scroll_time
integer
The maximum amount of time the page should be scrolled for, in milliseconds. After this time passes, the action will be cancelled. This doesn't cause the action to fail. Default: 20,000 (20s)
scroll_speed
string
interval
integer
See universal parameters.
Scroll Speed & Interval
Gaffa gives you a flexibility about how fast you scroll down the page which can be really useful to get around restrictions enforced by some sites which detect and limit fast scrolling. By experimenting with scroll_speed
and interval
you will be able to create the perfect scrolling action for your scenario. The speed settings are as follows:
instant
- the page will smoothly scroll to the desired position immediately, useful for sites with no rate limits or loading events caused by scroll actions.medium
- human-like scrolling at a normal speed to the desired position. Gaffa will scroll in much the same way as you would using a mouse.slow
- human-like scrolling at a very slow speed to the desired position. The speed is comparable to scrolling whilst reading a page.
interval
allows you to adjust the scroll speed further by inserting pauses between scroll events.
We've found some sites with infinite scrolling and strict rate limits respond better to immediate
speed scroll events to the bottom of the page with large intervals
between these scrolls to keep within rate limits.
Wait Time
If wait_time
is set to 0 and Gaffa arrives at the desired location then Gaffa will immediately mark the action as succeeded. However, if another value is set then the page will be monitored for the desired amount of time to check for further expansions. If, during this period, the page expands again then Gaffa will continue scrolling to the desired location and the wait will reset.
This can be really useful if you find that the site takes some time to load more items when you reach the bottom of the page and more will be loaded after the action has suceeded.
Usage
Scroll a particular percentage down the page
The following code will scroll half way down the page.
Scroll an infinitely scrolling webpage
The following code will scroll to the bottom of the page and then keep scrolling when new content loads for a maximum of 25 seconds, waiting 1 second for new content and scrolling at a slow pace with 1 second between scroll actions.
Last updated