If you need scroll the page for example take a screenshot in a browser different of Firefox (Yes, the selenium have a problem to take a screenshot of the entire page when you are in a different browser like, IE)
So we have to create a function that take a screenshot of parts of the page, and this function helps you to scroll the page.
First you have to import the libraries:
import org.openqa.selenium.JavascriptExecutor;
After the code:
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript(“window.scrollTo(0,Math.max(document.documentElement.scrollHeight,”
+ “document.body.scrollHeight,document.documentElement.clientHeight));”);
After this, the driver will scroll until the end of the current page.
I hope that I help you 🙂