ChromeDriver版本不匹配问题的解决

今天运行一个以前写的爬虫程序,遇到如下错误:

python 复制代码
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 121
Current browser version is 133.0.6943.98 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

这个错误表明你正在使用的 ChromeDriver 版本与 Google Chrome 浏览器 的版本不兼容。具体来说,你的 ChromeDriver 只支持 Chrome 121 ,但你的浏览器版本是 Chrome 133.0.6943.98 。因此,你需要更新 ChromeDriver 以匹配你的浏览器版本。

要下载最新版本的ChromeDriver,访问:Chrome for Testing availabilityhttps://googlechromelabs.github.io/chrome-for-testing/ 在这个页面,可以看到用于测试的Chrome和ChromeDriver。我们只需要下载和自己浏览器匹配的ChromeDriver(大版本匹配即可,不用考虑小版本号)。

将下载文件进行解压。

然后在Python程序中指定ChromeDriver路径即可。

python 复制代码
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
import csv

from time import sleep


 
# Chromedriver的路径
chromedriver_path = r"e:\chromedriver-win64\chromedriver.exe"

# 设置Chrome选项
options = webdriver.ChromeOptions()
options.add_experimental_option('detach', True)
相关推荐
_Jimmy_4 小时前
Agent 溯源精度提升方案
人工智能·python·langchain
SamChan905 小时前
在Web应用中集成PDF多语言翻译功能:PDFTranslator API实战指南
前端·python·ai·pdf·yapi·机器翻译
天天进步20155 小时前
Python全栈项目--智能办公自动化系统
开发语言·python
颜酱5 小时前
09 | 重构项目结构
人工智能·python·langchain
kisloy6 小时前
【爬虫入门第8讲】Python爬虫反爬入门
开发语言·爬虫·python
Sisphusssss7 小时前
香橙派5plus GPIO
linux·python·ubuntu
颜酱8 小时前
08 | 把维度值同步到 Elasticsearch(生成阶段)
人工智能·python·langchain
久久学姐8 小时前
基础转码学 AI:Java+Python 双语言入门,3 个月可落地实战项目
java·python·ai·转码·实战项目
ZHOU_WUYI8 小时前
4. light wam 模型loss计算过程
开发语言·人工智能·python
nwsuaf_huasir8 小时前
【无标题】
python