SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81

∥☆過路亽.° 提交于 2020-03-10 05:05:12

问题


I am currently new to robot framework.I am currently using latest window version of chrome and chromedriver which is 80 but when i try to run the test it gives the message "SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81" in pycharm but currently beta version of 81 is only available. I have tried uninstalling everthing and reinstalling it again but nothing works can anyone help me with this.Thank you!

Screenshots below:


回答1:


This error message...

SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 81

...implies that the ChromeDriver v81 was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser where is version is other then 81.0.


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

  • You mentioned about using chromedriver=80 and chrome=80 but somehow while your program execution ChromeDriver v 81.0 is used.
  • So, it's quite evident your have chromedriver=81.0 present within your system and is present within the system PATH variable which gets invoked while you:

    driver = webdriver.Chrome()
    

Solution

There are two solutions:

  • Either you upgrade chrome to Chrome Version 81.0 level. (as per ChromeDriver v81.0 release notes)
  • Or you can override the default chromedriver v81.0 binary location with chromedriver v80.0 binary location as follows:

    from selenium import webdriver
    
    driver = webdriver.Chrome(executable_path=r'C:\path\to\chromedriver.exe')
    driver.get('http://google.com/')
    

Reference

You can find a couple of relevant discussions in:

  • How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium
  • selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 80
  • Ubuntu: selenium.common.exceptions: session not created: This version of ChromeDriver only supports Chrome version 79


来源:https://stackoverflow.com/questions/60296873/sessionnotcreatedexception-message-session-not-created-this-version-of-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!