I'm currently hard coding a scrolling using Selenium, Firefox Driver in Python, is there anyway for it to scroll smoothly up and down the page? The page can grow 20 times bigger than normal as the images in the page loads.
I need to scroll up and down multiple times , not missing out any part of the page.
The current method isnt efficient and sometimes doesnt scroll to some part of the page. The following is my current code
browser = webdriver.Firefox()
browser.get(link)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/3.4);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/3.5);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/3.7);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/3.8);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/4);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/4.2);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/4.3);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/4.5);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/4.7);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/4.9);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/5.2);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/5.1);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/5.8);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/3.7);")
time.sleep(0.2)
browser.execute_script("window.scrollTo(0, document.body.scrollHeight/50);")
time.sleep(0.2)