scroll up and down in selenium webdriver

By | April 18, 2019

In this article, you are going to learn how to scroll up or down or horizontally using Selenium WebDriver and java script.

Java script executor syntax: 


We can scroll in the page in below ways.

1 Scroll by Pixel

2 Scroll to the bottom of the page

3 Scroll until the element is found

4 Scroll horizontally in web page. 

5 Scroll up/top of the page.


1 Scroll by Pixel:


Summary: Using scrollBy method, we can scroll in the web page by the specified number of pixels.

2 Scroll to the bottom of the page:


Summary: Using above code, we can scroll to the bottom of the page.

3 Scroll till element is found:


4 Scroll horizontally:


5 Scroll up:




Tags: Scroll in selenium webdriver; Scroll Up using selenium WebDriver; Scroll Down using selenium WebDriver; Scroll horizontally;

Leave a Reply

Your email address will not be published. Required fields are marked *