Scrolling in Selenium WebDriver

Open 1 Answers 194 Views Selenium
0 1
I have to scroll the results obtained after the search, so how to use scroll functionality in Selenium WebDriver Java?

1 Answer


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

answered by
commented by
Hi Mayur,

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

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

We have resolved 1.2k+ Software Testing queries!

Top Contributors