How to Scroll into view in Selenium Webdriver

Some days back I was automating my application I got one scenario where I had so many scroll bar into single page itself and I have to scroll all bar one by one to get specific text which I had to validate.

If you are not aware of how to validate text then below post will help you How to verify text in Selenium

You might have requirement to scroll down page but this requirement was different so here I used Java Script executor, which allowed me to scroll into view.

If you want to scroll down page itself then you can check below post which allow us to to the same.

Scroll into view in Selenium

 

How to scroll down into page using Selenium Webdriver

How to Scroll into view in Selenium Webdriver.

Now let us talk about how exactly we can scroll this using Selenium. Unfortunately Selenium does not have inbuilt method which allow us to scroll into view but it does not mean we cannot scroll.

We can scroll into view in Selenium using JavaScript executor.

You must be wondering now Java Script will help us in this case. I have created a post, which actually tells you what is the need of JavaScript in Selenium, and what are the other thing, which we can do via Java Script.

What is Java Script Executor in Selenium and What are the Usage of Same.

 

 

Recently I have uploaded a video on the same please check.

 

Program for Scroll into view in Selenium Webdriver

Now we will see the detailed program for this we actually scroll into view in Selenium, will extract the text, and will verify the same.

In my case, I am just verifying it but in your case, you may have to perform some other activity as well.

I will be using this application as Sample- Sample Application for Demo

If you find this useful then please share with friends. Comment below if any doubt, suggestion or feedback.

For More updates Learn Automation page

For any query join Selenium group- Selenium Group

36 Comments

  1. anjali
    • anjali
  2. SHWETABH SRIVASTAVA
  3. Shraddha Gautam
  4. Venkatesh
  5. roja
  6. Ravi
  7. Bala
  8. Mohammed Shahab Ahmed
  9. Abhishek Singh
  10. Rasta Jeff
  11. Ann
  12. Vishy
  13. Karl Fokum
  14. manoj kumar mahato
  15. Vahe
  16. salma

Leave a Reply