import time
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.options import Options
def down_png(url):
# 初始化 Chrome WebDriver
options = Options()
options.add_argument("--headless") # 开启无头模式
driver = webdriver.Chrome()
# 打开网页
driver.get(url)
wait = WebDriverWait(driver, 5)
try:
next_button = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '.btn-outline-secondary')))
action = ActionChains(driver)
action.move_to_element(next_button).click().perform()
time.sleep(2)
finally:
# 关闭浏览器
driver.quit()
10-08
5932
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-25
309
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-05