power_settings_new

Scrolling in Selenium WebDriver

by
0 votes
225 views
I have to scroll the results obtained after the search, so how to use scroll functionality in Selenium WebDriver Java?

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.

1 Answer

by
0 votes

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.
add
...