selenium滚动条
程序如下:
from selenium import webdriver from time import sleep driver = webdriver.Chrome() driver.get("https://www.baidu.com/") #拖动到滚动条底部---向下 js = "var q=document.documentElement.scrollTop=10000" driver.execute_script(js) sleep(3) #滚动左右滚动条---向右 js2 = "var q=document.documentElement.scrollLeft=10000" driver.execute_script(js2) sleep(3) #滚动左右滚动条---向左 js3 = "var q=document.documentElement.scrollLeft=0" driver.execute_script(js3) # #控制滚动条逐步滚动 # for y in range(15): # js = "window.scrollBy(0,100)" # driver.execute_script(js) # sleep(1)
相关推荐
letheashura 2020-06-26
Reiki 2020-06-14
王练 2020-06-12
xiangxiaojun 2020-09-23
Reiki 2020-08-16
letheashura 2020-08-14
tiankele0 2020-07-29
curiousL 2020-07-18
王练 2020-07-18
tiankele0 2020-07-18
amei0 2020-07-08
Reiki 2020-07-06
Ronnyxie 2020-07-06
xiangxiaojun 2020-07-05
zhanghaibing00 2020-06-28
xiongyouqiang 2020-06-28
Ronnyxie 2020-06-27
amei0 2020-06-26