SessionNotCreatedException:此版本的 ChromeDriver 仅支持 Chrome 版本 84 使用 ChromeDriver 和 Chrome 通过 Selenium 和 Python
问题描述
<块引用>我在 Windows 7、selenium、chromedriver 版本 84 上使用 python 3(最新)自动化我的 chrome 浏览器.
我正在使用这个脚本:
from selenium import webdriver#import chromedriver_binary # 将 chromedriver 二进制文件添加到路径驱动程序 = webdriver.Chrome()driver.get("http://www.python.org")
我在运行它时总是遇到这个错误.
Traceback(最近一次调用最后):文件D:HuzefaDesktopzzzzzz.py",第 4 行,在 <module>驱动程序 = webdriver.Chrome()文件C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriverchromewebdriver.py",第 81 行,在 __init__期望的能力=期望的能力)文件C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriveremotewebdriver.py",第 157 行,在 __init__self.start_session(功能,浏览器配置文件)文件C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriveremotewebdriver.py",第 252 行,在 start_session响应 = self.execute(Command.NEW_SESSION,参数)文件C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriveremotewebdriver.py",第 321 行,在执行self.error_handler.check_response(响应)文件C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriveremoteerrorhandler.py",第 242 行,在 check_response引发异常类(消息、屏幕、堆栈跟踪)selenium.common.exceptions.SessionNotCreatedException:消息:会话未创建:此版本的 ChromeDriver 仅支持 Chrome 版本 84
我的 ChromeDriver 在路径中.我也使用过其他版本的 chromedriver,但我无法导航到网站!
解决方案您的 ChromeDriver 版本和您安装的 Chrome 版本需要匹配.您正在为 Chrome 版本 84 使用 ChromeDriver,在给出这个答案时,它是一个测试版(不稳定) 构建 Chrome;你可能没有使用它.您可能使用的是 83 版.
检查您的 Chrome 版本(帮助 -> 关于),然后找到正确的 ChromeDriver 版本.您可以改用 webdriver-manager
来为您处理.p>
I am using python 3 on windows 7, selenium, chromedriver version 84 (latest) to automate my chrome browser.
I am using this script:
from selenium import webdriver
#import chromedriver_binary # Adds chromedriver binary to path
driver = webdriver.Chrome()
driver.get("http://www.python.org")
and I always get this error upon running it.
Traceback (most recent call last):
File "D:HuzefaDesktopzzzzzz.py", line 4, in <module>
driver = webdriver.Chrome()
File "C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriverchromewebdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriveremotewebdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriveremotewebdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriveremotewebdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:UsersHuzefaAppDataLocalProgramsPythonPython36libsite-packagesseleniumwebdriveremoteerrorhandler.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 84
My ChromeDriver is in path. Also i have used other versions of chromedriver but i am not able to navigate to a website!
解决方案Your ChromeDriver version and your installed version of Chrome need to match up. You are using ChromeDriver for Chrome version 84, which at the time of this answer, is a beta (non-stable) build of Chrome; you're probably not using it. Likely you're on version 83.
Check your Chrome version (Help -> About) and then find the correct ChromeDriver release. You could instead use webdriver-manager
which can handle this for you.
相关文章