SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 74 though Chrome v74 is installed

后端 未结 4 426
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-19 16:23

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 chr

4条回答
  •  庸人自扰
    2021-01-19 17:19

    This error message...

    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)
    

    ...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 :

    Supports Chrome v74

    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.


    Solution

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


    Alternative

    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()
    

    You can find a detailed discussion in Cannot find Chrome binary with Selenium in Python for older versions of Google Chrome


    Reference

    You can find a relevant detailed discussion in:

    • How to work with a specific version of ChromeDriver while Chrome Browser gets updated automatically through Python selenium

提交回复
热议问题