How to scroll page with selenium How to scroll page with selenium selenium selenium

How to scroll page with selenium


If you want to scroll on the firefox window using selenium webdriver, one of the way is to use javaScript in the java code, The javeScript code to scroll down is as follows:

WebDriver driver = new FirefoxDriver();JavascriptExecutor js = (JavascriptExecutor)driver;js.executeScript("window.scrollTo(0,Math.max(document.documentElement.scrollHeight," + "document.body.scrollHeight,document.documentElement.clientHeight));");


I think you should do something like

driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

Good Luck.


Use this code to scroll single page down

Actions actions = new Actions(driver);actions.sendKeys(Keys.BACK_SPACE).perform();