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

1 like 0 dislike
215 views
by The go-to Tester (391 points)
How to scroll a page vertically by 80px with Selenium Webdriver and Java?

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)

Scrolling up should be as below.

((JavascriptExecutor) driver).executeScript("scroll(0,-80);");
 
To scroll down
 
((JavascriptExecutor) driver).executeScript("scroll(0,80);");
 
You need to figure out equivalent value of 80px here. As -80 is not equivalant to 80px
 
Hope that helps.


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!

1.4k questions

1.6k answers

866 comments

1.9k users

...