In this post we will learn How to scroll web page Up or Down using Selenium Webdriver. There are various methods for scrolling page vertically and horizontally both. Go through to the below description, code and execution as well which will let you know to work on scroll conditions of a web page.
Scroller is mostly automated while testing E-commerce or any social media application. Let’s take an example of very popular website www.amazon.in Before automating amazon find the description of methods used in selenium webdriver to scroll page.
Before starting you have to import jar files in eclipse. CLICK HERE to download desired Jar’s and import the same in your system.
How to scroll page Down Using Selenium Webdriver:
Window.scrollBy() method is used to scroll down the page by specified number of pixels.
How many pixels to scroll by X-Axis, in other words we can say scroll page horizontally.
Positive values will scroll the page to the left and negative values will scroll the page to the right.
How many pixels to be scrolled along y axis or to scroll the page vertically.
Positive values will scroll down while negative values will scroll Up.
1. If you want to scroll page in vertically down, you can use following code: