Scroll the Page With Window Element
There are several things you can do with the Window element. Click and add it to your formula. Click on the pencil button to edit.
The main feature that is enabled by this element is scrolling. You can choose to scroll the page by a certain amount of pixels or scroll to a certain position.
Scrolling is really necessary when you have to scrape the page with AJAX loading the page when you scroll to the end of it.
You can enter these coordinates by hand, but the problem is that you will probably not know the amount needed.
That’s why we have added a few more modes to it.
URL - you can save the current URL, hostname, pathname, and protocol.
Size - you can measure the window or the page. Or you can save the current X or Y position.
Now, let’s say that we want to scroll this preview page to the bottom.
We will first measure the height of the page and save it as pageHeight. Hit update.
Then we will create another Window element, use the Scroll mode and grab the Y coordinates from the data we have just added to the document with the last element.
Let’s choose data and type in pageHeight. Hit update.
We have made the first Window element to save the height of the page and now we use the second element to scroll the page.
Let’s save the formula and run it to see how it works.
Now, if you look at the table the formula has made, there will be a column for the page Height. Sometimes you will need it and sometimes not.
You can hide the column by going to the Data tab and choose the Export data mode: Exclude. Enter pageHeight and press the plus button.
Let’s scroll back to the top of the page and run the formula one more time. Now it won’t show up in your results.