Subhankor Sekhar
Subhankor Sekhar

Reputation: 111

How to scroll a webpage using selenium webdriver in Python without using javascript method execute_script()

I am trying to scroll a web page by using mouse and scroll bar. I am exploring any other option than

"driver.execute_script("window.scrollBy(0, 5000'))"

I did try options like chrome actions, however nothing seems to be working. Would need some guidance if anyone has any idea how to solve this.

Upvotes: 2

Views: 1880

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193308

If your usecase is to scroll() the window containing the DOM document, there is no better way other then using the either of the following Window Methods:

If your usecase is to scroll() an Element there is no better way other then using the Element Method:

You can find a detailed discussion in What is the difference between the different scroll options?


However, if you want to avoid the execute_script() to interact with a WebElement you have two (2) other options available as follows:

Upvotes: 2

Related Questions