Join 500+ Software Testing professionals. Solve problem and get your problem solved. Register Now!

0
How to Scroll Up Web Page In Selenium Webdriver?

Solved 1 Answers 71 Views
0 1

How to Scroll Up Web Page In Selenium Webdriver?

Thank You

1 Answer

0
Best answer
0

You can use JavaScript to scroll the page in Selenium WebDriver.

 

((JavascriptExecutor) driver).executeScript("scroll(0,300)");
 
Here, (0,300) are the horizontal and vertical distances respectively. You can put the distance as per your requirement.
 
You can try this Firefox add-on, MeasureIt to get perfect distance.
 
hope that helps.
answered by (151 points)
selected by
2Comments
commented by (324 points)
and what about left to right and right to left scroll?
commented by (151 points)
As per the answer, in (0,300) the first value is horizontal value, so changing that will help you scroll horizontally / left or right and 300 is vertical distance, So changing that value will help you scroll up and down.

Hope I answered it.

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