Monday, 17 August 2015

Page scroll up/Down in Selenium.

Using Selenium RC1
selenium.getEval("window.scrollTo(0,0)");

Using WbdDriver
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);");

No comments:

Post a Comment