Selenium: Selenium Webdriver can't find Chrome binary after new install of Chrome v85

Created on 7 Sep 2020  路  14Comments  路  Source: SeleniumHQ/selenium

馃悰 Bug Report

My Python program uses Selenium (v3.141.0) Webdriver to automate web browsing. It was working with Chrome v84. However, now, with Chrome v85, it fails with the following error message:

 selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary.

My program uses chromedriver_autoinstaller to download the correct version of ChromeDriver to match the version of the Chrome browser.

If I uninstall Chrome v85 and install Chrome v84, the program works just fine.

-->

To Reproduce

Detailed steps to reproduce the behavior:

1.) Created new Windows 10 image on Azure Cloud
2.) Compiled my "GoogleSearch.exe" Python program (listed below) and loaded it to the new Windows 10 Image
3.) Installed Chrome v85
4.) Opened cmd window on new windows 10 image and started "GoogleSearch.exe"

Expected behavior

Previously, my "GoogleSearch.exe" Python program would open Chrome at the Google search page.

Test script or set of commands reproducing this issue

GoogleSearch.py:

import PySimpleGUI as sg, chromedriver_autoinstaller
from selenium.webdriver.chrome.options import Options  
from selenium import webdriver

sg.theme('Light Blue 2')

layout = [[sg.Frame('',[[sg.Text('Google Search', size = (20, 1), font = ('', 17)), sg.Button('Start')],
               [sg.Text('Click "Start" to open the Google search window.  Click "Exit" to close this window and exit', size = (40, 3))]]),],
               [sg.Button('Exit')]]

window = sg.Window('', layout, keep_on_top = True)
event, values = window.read()

if event == 'Start':
    while event == 'Start':
        options = Options()
        options.add_experimental_option('excludeSwitches', ['enable-logging'])        
        driver = webdriver.Chrome(options = options, executable_path = chromedriver_autoinstaller.install(cwd = True))
        driver.get('http://www.google.com') 
        event, values = window.read()
        driver.quit()
window.close()

Issues without a reproduction script are likely to stall and eventually be closed.

Environment

OS: Windows Version 10
Browser: Chrome
Browser version: v85.0.4183.83
Browser Driver version: ChromeDriver v85.0.4183.38
Language Bindings version: Python v3.8.5
Selenium Grid version (if applicable):

R-awaiting answer

All 14 comments

@DavidGurley no changes in Selenium have been made to trigger what you describe. Also, if this was a bug in Selenium, the number of issues created related to it would be considerable, since Chrome is widely used. Have you checked if the issue is not related to https://github.com/yeongbin-jo/python-chromedriver-autoinstaller? It is not uncommon to see this error when 3rd party tools are used to configure the browser drivers.

Diemol,

Understood. I agree.

However, chromedriver-autoinstaller seems to be working as expected. The correct chromedriver version v85 is downloaded to CWD. The problem appears to be with webdriver comparing the version of the newly installed Chrome v85 with chromedriver v85 and not finding a match. My work around is to install Chrome v84 and everything works fine. This problem is very easy to reproduce as it consistently happens every time.

Is this the correct forum to report a possible bug with webdriver?

Here is the traceback information:

C:\LI-Prospector>GoogleSearch.exe
Traceback (most recent call last):
   File "GoogleSearch.py", line 18, in <module>
   File "selenium\webdriver\chrome\webdriver.py", line 76, in __init__
   File "selenium\webdriver\remote\webdriver.py", line 157, in __init__
   File "selenium\webdriver\remote\webdriver.py", line 252, in start_session
   File "selenium\webdriver\remote\webdriver.py", line 321, in execute
   File "selenium\webdriver\remote\errorhandler.py", line 242, in check_response
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

[3956] Failed to execute script GoogleSearch

What happens if you do the installation manually? Setting up ChromeDriver yourself in the path.
Also, is there something setting up the Chrome binary directory?

My program has the same problem when I manually setup chromedriver.exe in the path. Chrome v84 and chromedriver.exe v84 work with no issues. Chrome v85 and chromedriver.exe v85 do not.

The chromedriver_autoinstaller checks the version of Chrome. It then creates the chromedriver directory for that version. Next it downloads the appropriate version of chromedriver.exe into that folder and sets the path so that webdriver can find it.

One other thing that I noticed. If Chrome auto updates from v84 to v85, my program continues to work with chrome v85 and chromedriver.exe v85. It's only if I download and install Chrome v85 on a new Windows 10 image that it fails. My current workaround is to install Chrome v84 and let it autoupdate to v85. My program will automatically load the new chromedriver.exe version and continue to work as expected.

Have you tried using plain Selenium without the dependency? Honestly, I don't see how this could be related to Selenium because there is no logic in the code looking or comparing versions, it just opens the ChromeDriver present in the path or it looks for the binary wherever it was told by the capabilities. If you can give us a test case that reproduces this only using the Selenium bindings, we would be happy to have a look.

diemol,

I just uninstalled the Google Chrome browser on my Windows 10 system and installed it fresh from the Google Chrome download website. Version 85.0.4183.102 (Official Build) (64-bit) was installed. I made sure chromedriver.exe v85 was in the path. I ran the very simple Python program shown below and it failed!

GoogleSearch.py:
    1)     from selenium import webdriver
    2)     driver = webdriver.Chrome()
    3)     driver.get('http://www.google.com')

Traceback (most recent call last):
    File "GoogleSearch.py", line 3, in <module>
    File "selenium\webdriver\chrome\webdriver.py", line 76, in __init__
    File "selenium\webdriver\remote\webdriver.py", line 157, in __init__
    File "selenium\webdriver\remote\webdriver.py", line 252, in start_session
    File "selenium\webdriver\remote\webdriver.py", line 321, in execute
    File "selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

I then unintalled Google Chrome v85 and installed the previous version of Google Chrome v84.0.4147.135 (Official Build) (64-bit) and ran my program again. I received the same messages as before with the additional error message: selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 85.

I let the the Chrome browser auto update to the current version 85.0.4183.102 (64-bit) and ran my program again. This time it worked as expected.

@DavidGurley Did you do anything more than a simple Windows installer uninstall of chrome 85 in order to reproduce this?

I am not getting the same error message, but I am also working in C# rather than python. But after our build agents were updated from v83 to v85 (a manual install of 85 rather than auto-updating) I began getting an error message that the request to the remote WebDriver server has timed out, and nothing I have tweaked has been able to resolve this, but it is only a problem on these build agents where 85 was installed directly rather than having been updated to it. So now I am trying to see if I can reproduce this locally, but am not having much luck.

JBelisle,

I initially found this error when I created a brand new Windows 10 VM on Azure and installed the Chrome browser v85 directly from the Chrome download site (No uninstall was performed). I was able to easily reproduce this error over and over again because I could easily recreate a brand new Windows 10 VM on Azure from scratch and rerun the test.

https://www.ghacks.net/2020/06/11/google-chrome-is-soon-going-to-be-installed-in-a-different-directory-on-windows/

Looks like Google Chrome is being installed in C:\Program Files\Google\Chrome\Application\chrome.exe rather than C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

Had to change binary_location.

Fytex,

That would certainly explain the Selenium error message listed in my comment above:

  selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary

It looks like Selenium Webdriver needs to be updated to look for the Chrome binary in the new location. How do we request a fix for this and how long will it take to get the update?

It is mentioned in the release notes as well..

Seems the new Chrome location on Windows causes this, but if Chrome and ChromeDriver are kept in sync, it should be fixed. By default, the one responsible to find the Chrome binary is ChromeDriver, not Selenium WebDriver. That is why it is not a Selenium issue.

More information can be seen in this Azure thread https://developercommunity.visualstudio.com/content/problem/1170486/selenium-ui-test-can-no-longer-find-chrome-binary.html

Was this page helpful?
0 / 5 - 0 ratings