Home > Automation Testing > Code to scroll in web page using selenium

Code to scroll in web page using selenium

This post was most recently updated on June 14th, 2019

Scroll can be done in two ways one is horizontal and another is vertical. In selenium scroll operation is done using JavaScriptExecutor.

Code to scroll vertically Down by 500 pixel:

Code to scroll vertically UP by 500 pixel:

Code to scroll horizontally RIGHT by 500 pixel:

Code to scroll horizontally LEFT by 500 pixel:

Note: We can provide any pixel based on our requirement.

Selenium Tutorial >>

This Article is TAGGED in . BOOKMARK THE permalink.

Avatar photo
Amit Bharamasali
Automation Software Test Engineer. Skills: Manual Testing, Selenium, Java, Protractor, JavaScript, Katalon Studio, Groovy, Appium, Sahi, Sahi Script and UI/UX testing.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">