Answers for "selenium scroll to the end of the page"

0

how to scroll down to end of page in selenium python

SCROLL_PAUSE_TIME = 0.5

# Get scroll height
last_height = driver.execute_script("return document.body.scrollHeight")

while True:
    # Scroll down to bottom
    driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")

    # Wait to load page
    time.sleep(SCROLL_PAUSE_TIME)

    # Calculate new scroll height and compare with last scroll height
    new_height = driver.execute_script("return document.body.scrollHeight")
    if new_height == last_height:
        break
    last_height = new_height
Posted by: Guest on June-07-2021

Code answers related to "selenium scroll to the end of the page"

Python Answers by Framework

Browse Popular Code Answers by Language