Created
July 10, 2018 18:18
-
-
Save ValchanOficial/96e73fc1118abeb457ad2954b790a90f to your computer and use it in GitHub Desktop.
Scroll UP or Down a page in Selenium Webdriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.guru99.com/scroll-up-down-selenium-webdriver.html#2 | |
https://stackoverflow.com/questions/12293158/page-scroll-up-or-down-in-selenium-webdriver-selenium-2-using-java | |
For Scroll down: | |
WebDriver driver = new FirefoxDriver(); | |
JavascriptExecutor jse = (JavascriptExecutor)driver; | |
jse.executeScript("window.scrollBy(0,250)", ""); | |
OR, you can do as follows: | |
jse.executeScript("scroll(0, 250);"); | |
For Scroll up: | |
jse.executeScript("window.scrollBy(0,-250)", ""); | |
OR, | |
jse.executeScript("scroll(0, -250);"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment