解决:Message: session not created: This version of ChromeDriver only supports Chrome version 114

解决:Message: session not created: This version of ChromeDriver only supports Chrome version 114

背景

在使用之前的代码通过web驱动执行时,报错:selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 119.0.6045.124 with binary path xxx

报错问题

File "D:\develop\python\Python3\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 90, in __init__
    keep_alive,
  File "D:\develop\python\Python3\Python37\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 114, in __init__
    options=options,
  File "D:\develop\python\Python3\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "D:\develop\python\Python3\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "D:\develop\python\Python3\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "D:\develop\python\Python3\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 119.0.6045.124 with binary path xxx

截图如下:
在这里插入图片描述

报错翻译

主要报错信息内容翻译如下所示::
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 119.0.6045.124 with binary path xxx
翻译:
selenium.common.exceptions.SessionNotCreatedException: 消息:会话未创建:此版本的ChromeDriver只支持Chrome 114版本
当前浏览器版本为119.0.6045.124,二进制路径为xxx

报错原因

这个报错是由于当前的Chrome版本是119,但ChromeDriver版本是114。需要使用最新版的谷歌驱动安装。国内正常用的网址是:https://registry.npmmirror.com/binary.html?path=chromedriver

但里面最新只到114,所以需要更新的版本。

小伙伴们按下面的解决方法即可解决!!!

解决方法

因此,通过搜索,找到了这个网址,里面有最新的版本:Chrome for Testing availability。

下载最新的版本后,问题解决。

安装可点击参考ChromeDriver谷歌浏览器驱动下载安装与使用最新版118/119/120



今天的分享就到此结束了

欢迎点赞评论关注三连

在这里插入图片描述

你可能感兴趣的:(Python,chrome,python,前端)