Categories
Python Answers

How to scroll a web page using Selenium webdriver in Python?

Spread the love

Sometimes, we want to scroll a web page using Selenium webdriver in Python.

In this article, we’ll look at how to scroll a web page using Selenium webdriver in Python.

How to scroll a web page using Selenium webdriver in Python?

To scroll a web page using Selenium webdriver in Python, we can run the JavaScript window.scrollTo method.

For instance, we write

driver.execute_script("window.scrollTo(0, y)") 

to call window.scrollTo on the opened page to scroll to vertical position y.

Conclusion

To scroll a web page using Selenium webdriver in Python, we can run the JavaScript window.scrollTo method.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

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