Skip to content

Instantly share code, notes, and snippets.

@JasonCrowe
Last active April 11, 2019 17:18
Show Gist options
  • Save JasonCrowe/ea594790cc043d54080d0bde8c3579ee to your computer and use it in GitHub Desktop.
Save JasonCrowe/ea594790cc043d54080d0bde8c3579ee to your computer and use it in GitHub Desktop.
Selenium Infinate Scroll
#infinite scroll
last_height = driver.execute_script("return document.body.scrollHeight")
SCROLL_PAUSE_TIME = 7
while True:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
sleep(SCROLL_PAUSE_TIME)
new_height = driver.execute_script("return document.body.scrollHeight")
if new_height == last_height:
break
last_height = new_height
sleep(1.2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment