通过执行js对滚动条的操作
- 拖动至底部
from selenium import webdriver
import time
def scroll():
driver = webdriver.Chrome()
js="document.documentElement.scrollTop=100000"
driver.execute_script(js)
time.sleep(3)
- 将滚动条移动到页面的顶部
def scroll():
driver = webdriver.Chrome()
js="document.documentElement.scrollTop=0"
driver.execute_script(js)
time.sleep(3)