简体   繁体   English

selenium.common.exceptions.SessionNotCreatedException:消息:session 未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 83

[英]selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 83

So this is my first time working with selenium, and I get the chromedriver browser to open fo a quarter of a second and then it closes, even it I give it a webpage to load or I tell it to sleep.所以这是我第一次使用 selenium,我让 chromedriver 浏览器打开四分之一秒然后它关闭,即使我给它一个网页加载或者我告诉它睡觉。 It also gives me a SessionNotCreatedException.它还给了我一个 SessionNotCreatedException。

Code:代码:

from selenium import webdriver
import time

class TestBot():
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.get('http://www.google.com/')
        time.sleep(5)

Error:错误:

>>> bot = TestBot()

DevTools listening on ws://127.0.0.1:55101/devtools/browser/7029bc33-860f-42b8-8fb5-751cf27f82bc
[16708:17644:0524/045808.952:ERROR:browser_switcher_service.cc(238)] XXX Init()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "test_bot.py", line 6, in __init__
    self.driver = webdriver.Chrome()
  File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\Caleb\test_bot\test_bot\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Caleb\test_bot\test_bot\lib\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: This version of ChromeDriver only supports Chrome version 83

I've tried adding Chromedriver as a path variable and that didn't work.我尝试将 Chromedriver 添加为路径变量,但没有奏效。 I can start a chromedriver session just fine in cmd.我可以在 cmd 中启动 chromedriver session。

I think you should try running Selenium with MozillaFirefox,you also will need to install Geckodriver, which is a software that acts as a bridge between Firefox and selenium.我认为您应该尝试使用 MozillaFirefox 运行 Selenium,您还需要安装 Geckodriver,这是一个充当 Firefox 和 Z8E00596AD8DE2213FF8F8D8478D5362Z 之间的桥梁的软件。

I was looking at the wrong version of chrome, turns out I have version 81, so I installed webdriver-manager and that works我正在查看错误版本的 chrome,结果我有 81 版,所以我安装了 webdriver-manager 并且可以正常工作

as we see in the last line:正如我们在最后一行看到的:

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 83

try to:尝试:

  • update Chrome to last version so selenium too将 Chrome 更新到最新版本,所以 selenium

  • use geckodriver.exe for chrome, and put inside a folder then try:geckodriver.exe用于 chrome,然后放入文件夹中,然后尝试:

self.driver = webdriver.Chrome(r"c:\your\geckodriver\path\withput\")

This error message...此错误消息...

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 83

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context ie Chrome Browser session. ...意味着ChromeDriver无法启动/产生新的浏览上下文,即Chrome 浏览器session。


Analysis分析

Your main issue is the incompatibility between the version of the binaries you are using as follows:您的主要问题是您使用的二进制文件版本之间的不兼容,如下所示:

  • You are using ChromeDriver 83.0您正在使用ChromeDriver 83.0
  • Release Notes of ChromeDriver 83.0 clearly mentions the following: ChromeDriver 83.0的发行说明清楚地提到了以下内容:

Supports Chrome version 83支持Chrome 版本 83

Most possibly the Chrome Browser haven't been updated toChrome v83.0 yet as a part of the recent push and still isChrome v81.0作为最近推送的一部分, Chrome 浏览器很可能尚未更新到Chrome v83.0 ,并且仍然是Chrome v81.0

  • Your Selenium Client version is unknown to us.我们不知道您的Selenium 客户端版本。

So there is a clear mismatch between ChromeDriver v83.0 and the Chrome Browser v81.0因此ChromeDriver v83.0Chrome 浏览器 v81.0之间存在明显的不匹配


Solution解决方案

Ensure that:确保这件事:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 selenium.common.exceptions.SessionNotCreatedException:消息:session 未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 85 - selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 85 Ubuntu 上的 Chrome 驱动程序:selenium.common.exceptions.SessionNotCreatedException:消息:session 未创建 - Chromedriver on Ubuntu: selenium.common.exceptions.SessionNotCreatedException: Message: session not created SessionNotCreatedException:消息:会话未创建:此版本的 ChromeDriver 仅支持带有 Selenium ChromeDriver 的 Chrome 版本 76 - SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 76 with Selenium ChromeDriver SessionNotCreatedException:消息:session 未创建:此版本的 ChromeDriver 仅支持使用 Selenium ChromeDriver v81 的 Chrome 版本 81 - SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81 using Selenium ChromeDriver v81 SessionNotCreatedException:消息:会话未创建:此版本的 ChromeDriver 仅支持使用 ChromeDriver 和 Chrome 的 Chrome 版本 87 - SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 87 using ChromeDriver and Chrome selenium.common.exceptions.SessionNotCreatedException:消息:会话未创建,selenium python - selenium.common.exceptions.SessionNotCreatedException: Message: session not created, selenium python Ubuntu:selenium.common.exceptions:会话未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 79 - Ubuntu: selenium.common.exceptions: session not created: This version of ChromeDriver only supports Chrome version 79 SessionNotCreatedException:消息:session 未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 99 当前浏览器版本为 105 - SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 99 Current browser version is 105 SessionNotCreatedException:消息:session 未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 81 I - SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81 I SessionNotCreatedException:消息:未创建会话:尽管安装了 Chrome v74,但此版本的 ChromeDriver 仅支持 Chrome 版本 74 - SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 74 though Chrome v74 is installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM