SessionNotCreatedException:此版本的ChromeDriver仅支持使用ChromeDriver的Chrome 84版本以及通过Selenium和Python的Chrome [英] SessionNotCreatedException: This version of ChromeDriver only supports Chrome version 84 using ChromeDriver and Chrome through Selenium and Python

查看:641
本文介绍了SessionNotCreatedException:此版本的ChromeDriver仅支持使用ChromeDriver的Chrome 84版本以及通过Selenium和Python的Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7,Selenium,ChromeDriver 84版上使用python 3 (最新)来自动执行我的Chrome浏览器.

I am using python 3 on windows 7, selenium, chromedriver version 84 (latest) to automate my chrome browser.

我正在使用此脚本:

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:\Huzefa\Desktop\zzzzzz.py", line 4, in <module>
    driver = webdriver.Chrome()
  File "C:\Users\Huzefa\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\Users\Huzefa\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\Huzefa\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\Huzefa\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Huzefa\AppData\Local\Programs\Python\Python36\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 84

我的ChromeDriver在路径中.另外,我还使用了其他版本的chromedriver,但我无法导航到网站!

My ChromeDriver is in path. Also i have used other versions of chromedriver but i am not able to navigate to a website!

推荐答案

此错误消息...

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

...表示 ChromeDriver 无法启动/产生新的浏览上下文,即 Chrome浏览器会话.

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.

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

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

  • You are using chromedriver=84
  • Release Notes of chromedriver=84 clearly mentions:

支持 Chrome 84版本

  • 大概您使用的是Chrome最新推送 chrome = 83 .
    • Presumably you are using chrome=83 the latest push for Chrome.
    • 因此 ChromeDriver v84 Chrome浏览器v83

      有两个(2)解决方案.

      There are two (2) solutions to this issue.

      • 最简单的解决方案是下载并开始使用> > chromedriver = 83.0.4103.39
      • 如果要继续使用 chromedriver = 84 ,则必须从以下两个官方开发存储库中下载最新的 Chromium 二进制文件:
        • The easiest solution would be to download and start using chromedriver=83.0.4103.39
        • If you want to continue with chromedriver=84 you have to download the latest Chromium binary from either of the official development repositories:
          • The Chromium Projects
          • chromium.appspot
          • Chrome Canary - Nightly build for developers

          另外还要确保:

          • 已升级到当前级别版本3.141.59 .
          • 如果您的基本 Web客户端版本太旧,则将其卸载并安装最新版本的 Web客户端 GA.
          • 通过 IDE
          • 清理您的项目工作区重建您的项目,并且仅具有必需的依赖项.
          • 如果您的基本 Web客户端版本太旧,则将其卸载并安装最新版本的 Web客户端 GA.
          • 进行系统重启.
          • 非root用户用户的身份执行@Test.
          • 始终在tearDown(){}方法中调用driver.quit()以关闭&优雅地销毁 WebDriver Web Client 实例.
          • Selenium is upgraded to current levels Version 3.141.59.
          • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
          • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
          • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
          • Take a System Reboot.
          • Execute your @Test as non-root user.
          • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

          这篇关于SessionNotCreatedException:此版本的ChromeDriver仅支持使用ChromeDriver的Chrome 84版本以及通过Selenium和Python的Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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