selenium页面滚动加载到底部
import time
def scroll_to_bottom(driver):last_height = driver.execute_script("return document.documentElement.scrollHeight")print(f"Initial Document Height: {last_height}")while True:print("Scrolling down...")driver.execute_script("window.scrollTo(0, document.documentElement.scrollHeight);")time.sleep(3)new_height = driver.execute_script("return document.documentElement.scrollHeight")print(f"New Document Height: {new_height}")if new_height == last_height:print("Reached bottom of the page.")breaklast_height = new_height