2

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.

1 Answer 1

2

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:

Sign up to request clarification or add additional context in comments.

2 Comments

I had tried ActionChains but it is not giving me desired results. I was trying to scrape an intranet powerbi dashboard which has different sections all in iframe which can be scrolled. But thanks for your excellent answer.
move_to_element() doesn't seem to work properly in Firefox or geckodriver due to this (geckodriver issue #776). This may be the cause of the issue if you're using geckodriver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.