标签:webdriver sleep odi sele exec html http web coding
# coding = utf-8 import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.action_chains import ActionChains driver = webdriver.Chrome() # 打开指定网址 driver.get("https://www.cnblogs.com/xdclass/p/9842054.html") ele=driver.find_element(By.XPATH, ‘//*[@id="post_next_prev"]/a[4]‘) driver.execute_script(‘window.scrollTo(0,1000)‘) #滑到1000的位置 time.sleep(5) driver.execute_script(‘window.scrollTo(0,0)‘) #滑到顶部 time.sleep(5) driver.execute_script(‘window.scrollTo(0,document.body.scrollHeight)‘) #滑到底部 time.sleep(5) print("鼠标下拉结束") ele.click() # 点击指定a标签 time.sleep(5) driver.quit()
标签:webdriver sleep odi sele exec html http web coding
原文地址:https://www.cnblogs.com/ajie-linda/p/11655737.html