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

查看:119
本文介绍了SessionNotCreatedException:消息:未创建会话:尽管已安装Chrome v74,此版本的ChromeDriver仅支持Chrome版本74的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始在python中使用硒,当我尝试运行此代码时,它弹出一个错误,指出此版本的chromedriver仅支持chrome 74,但是我已经从此处下载了74: href ="https://chromedriver.storage.googleapis.com/index.html?path=74.0.3729.6/" rel ="nofollow noreferrer"> https://chromedriver.storage.googleapis.com/index.html?path = 74.0.3729.6/

I am starting to play around with selenium in python, and when i try to run this code it just pops an error that this version of chromedriver only supports version 74 of chrome, but I already downloaded version 74 from here: https://chromedriver.storage.googleapis.com/index.html?path=74.0.3729.6/

我要运行的代码:

import selenium
from selenium import webdriver

driver = webdriver.Chrome()
driver.get('https://stackoverflow.com')
driver.quit()

错误:

Traceback (most recent call last):
  File "c:/Users/Main/Desktop/Python web bot/Bot 
code/selenium_training.py", line 3, in <module>
driver = webdriver.Chrome()
  File "C:\Users\Main\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
  File "C:\Users\Main\AppData\Local\Programs\Python\Python37\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 74
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17134 x86_64)

如您所见,它说我需要74版chrome,但我已经拥有了!

As you can see, it says that I need version 74 chrome, but i already have it!

推荐答案

此错误消息...

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 74
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.17134 x86_64)

...表示 ChromeDriver 期望 Chrome浏览器版本为 74 .

...implies that the ChromeDriver expects the Chrome Browser version to be 74.

您的主要问题是所使用的二进制文件版本之间的不兼容性:

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=74.0.3729.6
  • Release Notes of chromedriver=74.0.3729.6 clearly mentions the following :

支持 Chrome v74

大概您在系统中安装了多个版本的 Chrome 浏览器,并且在 chromedriver = 74.0访问的默认位置安装了 Chrome 浏览器版本. .3729.6 不是不是 Chrome浏览器v74.0 .因此,您会看到错误.

Presumably you have multiple versions of Chrome browsers installed within your system and the version of Chrome browser installed at the default location which is accessed by chromedriver=74.0.3729.6 is not Chrome Browser v74.0. Hence you see the error.

最快的解决方案是将默认位置安装的 Chrome 版本升级到 Chrome v74 级别.

The quickest solution would be to upgrade Chrome version installed at the default location to Chrome v74 level.

或者,如果您想使用安装在非标准位置中的 Chrome 浏览器二进制文件,则可以将ChromeOptions()的实例与属性,以指向非标准Chrome浏览器位置,如下所示:

As an alternative, if you want to use the Chrome browser binary installed in a non-standard location you can use an instance of ChromeOptions() with the binary_location property to point to the non-standard Chrome Browser location as follows:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.binary_location = "C:\\Program Files\\Chrome\\chrome64_55.0.2883.75\\chrome.exe"
driver = webdriver.Chrome(chrome_options = options, executable_path=r'C:\path\to\chromedriver.exe')
driver.get('http://google.com/')
print("Chrome Browser Invoked")
driver.quit()

您可以在


参考

您可以在以下位置找到相关的详细讨论:


Reference

You can find a relevant detailed discussion in:

相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆