Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
383 views
in Selenium by
recategorized by
I have to scroll the results obtained after the search, so how to use scroll functionality in Selenium WebDriver Java?

1 Answer

0 like 0 dislike
by

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 scrolling up:

jse.executeScript("scroll(250, 0)");

by
Hi Mayur,

Thanks for your continuous support, you always come up with best solutions to my questions. But unfortunately this is not working.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...