Mouse scroll down using Selenium WebDriver (a.k.a. Selenium 2.0) - JAVA -
i trying mouse scroll in automation testing (selenium webdriver). page have loads of data take time load datum.
my requirement: have consolidated table set of datum, records displayed set of values displayed in bottom of page.
i validating whether both values equal, need page scrolled evaluate same.
i used below code:
javascript jse = (javascript)driver; jse.executescript("scroll(0, 9000)");
this doesn't scrolled half of datum test fail.
suggestions please...
we can use javascriptexecutor achieve this. following example scroll page top bottom:
webdriver driver = new chromedriver(); driver.get("http://stackoverflow.com/questions/25363023/mouse-scroll-down-using-selenium-webdriver-2-0-java"); javascriptexecutor jse = (javascriptexecutor) driver; jse.executescript("window.scrollto(0,document.body.scrollheight);");
to use above code please import below utilities:
import org.openqa.selenium.javascriptexecutor; import org.openqa.selenium.webdriver; import org.openqa.selenium.chrome.chromedriver;
lemme know if helps!
Comments
Post a Comment