Ubuntu 16.04 LTS解决报错“session not created: Chrome version must be between 70 and 73”

在Ubuntu 16.04 LTS系统中使用selenium时遇到“session not created: Chrome version must be between 70 and 73”的错误。解决方法包括检查Chrome版本,从官网下载匹配的ChromeDriver,解压并替换旧版本,最后更新系统路径。通过这些步骤,成功解决了报错问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

        在解决了上一条博客提到的问题后,又出现了新错误:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73
  (Driver info: chromedriver=73.0.3683.86,platform=Linux 4.15.0-48-generic x86_64)

        完整报错是这样的:

203.192.217.11:8080
Mozilla/5.0 (Linux; Android 7.0; Redmi Note 4X Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044304 Mobile Safari/537.36 MicroMessenger/6.7.3.1360(0x26070333) NetType/WIFI Language/zh_CN Process/tools
Traceback (most recent call last):
  File "main.py", line 70, in <module>
    driver = set_driver()
  File "/home/u25th_engineer/document/code/Python/Analog-access/driver.py", line 25, in set_driver
    return webdriver.Chrome(chrome_options=chromeOptions)
  File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/root/anaconda3/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome version must be between 70 and 73
  (Driver info: chromedriver=73.0.3683.86,platform=Linux 4.15.0-48-generic x86_64)

        解决方法:

        1. 在地址栏输入:

chrome://settings/help

查看自己的chrome浏览器版本(注意得是70到73的);

图1 查看chrome浏览器版本

 

        2. 到官网(因为是Google的原因,需要某些工具你懂的)下载对应的驱动(也可以找国内网站的资源,上网搜,都有的!);

图2 官网下载界面

 

        3. 选择了对应的chrome浏览器版本后,上面的网址将会指引你去下载对应版本的驱动;

图3 下载文件界面

 

        4. 下载完成后,到下载文件所在路径,打开终端;

        5. 解压文件(我安装了unar,所以可以如图这么干,一般.zip文件用unzip命令解压就行);

图4 解压文件

        6. 之后连续输入以下三个命令:

chmod +x chromedriver
sudo mv -f chromedriver /usr/local/share/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver
sudo ln -s /usr/local/share/chromedriver /usr/bin/chromedriver

如果出现如下类似提示:

图5 软链接已存在

 

把原来的删掉就行:

rm -rf  /usr/bin/chromedriver

第6步完成;

        7. 进入/usr/bin目录下确认是否有chromedriver文件:

cd /usr/bin
图6 查看文件是否存在

 

        8. 完成。

 

参考资料:

链接1

链接2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值