2

I was able to scroll a regular page use below code, but unable to scroll simple ajax infinite page like http://darsa.in/sly/examples/infinite.html

Any idea?


Working

driver = webdriver.Firefox()
driver.get('http://play.google.com/store')
driver.execute_script("window.scrollTo(0,10000);")

Not Working

driver = webdriver.Firefox()
driver.get('http://darsa.in/sly/examples/infinite.html')
driver.execute_script("window.scrollTo(0,10000);")

Thanks!

0

1 Answer 1

1

Set a page load time out before start scrolling. This will allow you to wait for 30s while page is not done with loading

driver = webdriver.Firefox()
driver.get('http://darsa.in/sly/examples/infinite.html')
driver.set_page_load_timeout(30)
driver.execute_script("window.scrollTo(0,10000);")
Sign up to request clarification or add additional context in comments.

3 Comments

Just tried, that doesn't work. The page doesn't scroll at all.
try using driver.execute_script("window.scrollTo(0, document.body.scrollHeight);"). selenium-python.readthedocs.org/… will give you more information how all the methods work
no luck, i will look into the link you provided. thanks anyway.

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.