求助:ChromeDriver版本122.0.6261.112(win32)下载失败问题
ChromeDriver版本匹配失败(No such driver version 122.0.6261.112 for win32)解决方案
以下是几种可行的解决方法:
强制指定驱动版本:如果ChromeDriverManager自动匹配失败,先在Chrome「设置-关于Chrome」里确认当前浏览器版本,再手动指定版本号安装驱动。修改代码如下:
import pyautogui as pa from time import sleep from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By op = Options() # 替换为你的Chrome实际版本号 driver = webdriver.Chrome(service=Service(ChromeDriverManager(version="122.0.6261.112").install()), options=op)若该版本无win32安装包,需降级或升级Chrome到有对应驱动的版本。
清理驱动缓存:旧缓存可能干扰版本匹配,找到Windows下的缓存目录
C:\Users\<你的用户名>\.wdm\drivers\chromedriver\win32\,删除其中所有文件后重新运行代码。手动下载驱动:直接下载对应版本的win32格式ChromeDriver,在代码中指定驱动路径使用:
import pyautogui as pa from time import sleep from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By op = Options() # 替换为你手动下载的chromedriver.exe绝对路径 service = Service(executable_path="C:/your/path/chromedriver.exe") driver = webdriver.Chrome(service=service, options=op)检查版本一致性:确保Chrome浏览器版本与驱动版本完全一致,若浏览器自动更新后驱动未同步发布,可暂时回退Chrome版本到有对应驱动的版本。
内容的提问来源于stack exchange,提问作者Anderson Araujo
相关产品推荐
相关产品推荐

