Skip to content

Модуль selenium

Фукнция для скролла до самого конца страницы

Python
def scroll_to_the_end():
    while True:
    last_height = driver.execute_script(
        "return document.body.scrollHeight"
    )
    driver.execute_script(
        "window.scrollTo(0, document.body.scrollHeight);"
    )

    sleep(1.5)
    new_height = driver.execute_script("return document.body.scrollHeight")

    if new_height == last_height:
        break

selenium #tool #python #scraping