You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ChromeDriver版本不兼容致Popcat自动化脚本运行失败求助

解决ChromeDriver与Chrome版本不匹配问题

问题原因

你下载了对应Chrome 116版本的ChromeDriver,但程序仍在调用旧的114版本驱动,导致版本不兼容报错。

解决方案

1. 确保ChromeDriver被正确识别

  • 将下载的ChromeDriver.exe放到Chrome安装目录(默认路径:C:\Program Files\Google\Chrome\Application\)
  • 或者放到Python的Scripts目录(比如你的路径:C:\Users\Ellen\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts)
  • 以上目录通常在系统PATH中,程序会优先查找这些位置的驱动

2. 在代码中直接指定驱动路径

如果不想修改文件位置,可在初始化WebDriver时明确指定ChromeDriver的路径:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
import time

co = Options()
co.add_experimental_option("detach", True)
co.add_argument("--disable-dev-shm-usage")
co.add_argument("--disable-gpu")
co.add_argument("--no-sandbox")

# 替换为你实际下载的ChromeDriver路径
bs = webdriver.Chrome(executable_path=r"C:\Users\Ellen\Downloads\chromedriver.exe", options=co)
bs.get("https://popcat.click/")

while True:
    bs.find_element(By.XPATH, '//*[@id="app"]/div').click()
    time.sleep(0.01)

3. 验证驱动版本是否正确

打开PowerShell,执行以下命令:

chromedriver --version

如果输出的版本不是116.x.x.x,说明系统中仍存在旧版本驱动:

  • 找到旧的ChromeDriver.exe文件并删除
  • 或者将新驱动所在目录添加到系统环境变量PATH的最前面

4. 用自动驱动管理工具(推荐)

安装webdriver-manager包自动匹配驱动版本,避免手动下载的麻烦:

pip install webdriver-manager

修改代码如下:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
import time

co = Options()
co.add_experimental_option("detach", True)
co.add_argument("--disable-dev-shm-usage")
co.add_argument("--disable-gpu")
co.add_argument("--no-sandbox")

# 自动下载并使用匹配版本的ChromeDriver
bs = webdriver.Chrome(ChromeDriverManager().install(), options=co)
bs.get("https://popcat.click/")

while True:
    bs.find_element(By.XPATH, '//*[@id="app"]/div').click()
    time.sleep(0.01)

内容的提问来源于stack exchange,提问作者TodGuess

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.10 13:00:19