Unknown error cannot find chrome binary linux

Selenium gives «unknown error: cannot find Chrome binary» when running chrome driver on Ubuntu

I am trying to run selenium [java] tests using chrome driver on Latest ubuntu.[16.04] I am getting the following error/exception. As an experiment, I replaced ChromeDriver binary with my native «helloworldApp»; I found that selenium is executing my binary. I believe the print «Starting ChromeDriver 2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320) on port 15306» is coming from chrome binary. But why selenium complaining that its not able to get the binary? Everything works fine on Windows. Please advice.

 [java] Starting ChromeDriver 2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320) on port 15306 [java] Only local connections are allowed. [java] Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary [java] (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.8.0-46-generic x86_64) (WARNING: The server did not provide any stacktrace information) [java] Command duration or timeout: 328 milliseconds [java] Build info: version: 'unknown', revision: 'unknown', time: 'unknown' [java] System info: host: 'geo-VirtualBox', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.8.0-46-generic', java.version: '9-internal' [java] Driver info: org.openqa.selenium.chrome.ChromeDriver [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(java.base@9-internal/Native Method) [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(java.base@9-internal/NativeConstructorAccessorImpl.java:62) [java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(java.base@9-internal/DelegatingConstructorAccessorImpl.java:45) [java] at java.lang.reflect.Constructor.newInstance(java.base@9-internal/Constructor.java:453) [java] at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) [java] at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) [java] at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678) [java] at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249) [java] at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) [java] at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:144) [java] at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:170) [java] at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:138) 

Источник

Читайте также:  For file in bash linux

WebDriverException: unknown error: cannot find Chrome binary error with Selenium in Python for older versions of Google Chrome

For compatibility reasons I prefer to use Chrome version 55.0.2883.75 with Chromedriver v. 2.26. I downloaded the older version of chrome from https://www.slimjet.com/chrome/google-chrome-old-version.php and Chromedriver 2.26 from https://chromedriver.storage.googleapis.com/index.html?path=2.26/. I am using the following code to attempt to set my Chrome binary location:

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('chromedriver.exe', chrome_options = options) 
WebDriverException: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.14393 x86_64) 

9 Answers 9

WebDriverException: unknown error: cannot find Chrome binary 

. implies that the ChromeDriver was unable to find the Chrome binary in the default location for your system.

The server expects you to have Chrome installed in the default location for each system:

OS Expected Location of Chrome
Linux /usr/bin/google-chrome 1
Mac /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
Windows XP %HOMEPATH%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe
Windows Vista and newer C:\Users%USERNAME%\AppData\Local\Google\Chrome\Application\chrome.exe

1 For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary.

Using a Chrome executable in a non-standard location

However you can also override the default Chrome binary location as follows:

To use Chrome version 55.x installed in non standard location through ChromeDriver v2.26 you can use the following code:

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 detailed discussion in:

Источник

unknown error: cannot find Chrome binary while attempting Maven test on Jenkins using ChromeDriver Chrome through Selenium

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

Supports Chrome v58-60

  • You are using chrome=59.0
  • Your Selenium Client version is 3.14.0 of 2018-08-02T20:19:58.91Z which is almost 2.5 years older.
  • Your JDK version is 1.8.0_121 which is pretty ancient.

So there is a clear mismatch between JDK v8u121 , Selenium Client v3.14.1 , ChromeDriver v2.30 and the Chrome Browser v59.0

Solution

  • JDK is upgraded to current levels JDK 8u232.
  • Selenium is upgraded to current levels Version 3.141.59.
  • ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
  • Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v79.0 release notes)
  • 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 through Revo Uninstaller 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.

Источник

Do we need to install Chrome binaries on Selenium grid to avoid getting «WebDriverError: unknown error: cannot find Chrome binary»? [duplicate]

I have set up a new selenium grid on Linux server executing the following way The first command —> ‘java -jar ./selenium-server-standalone-3.141.59.jar -role hub’ Second —> ‘java -Dwebdriver.chrome.driver=./grid/chromedriver -jar ./selenium-server-standalone-3.13.0.jar -role node -hub http://10.0.39.73:4444/grid/register/’ After going through the previous posts, helpers have been suggested to specify the driver path as I did. But still getting the same below error. Do I have to install the Chrome binary in the default location(/usr/bin/google-chrome) even if I want to use selenium grid?

[chrome #01-1] C:\Users\User1\Projects\ui-auto.qa\node_modules\selenium-webdriver\lib\error.js:546 [chrome #01-1] throw new ctor(message); [chrome #01-1] ^ [chrome #01-1] WebDriverError: unknown error: cannot find Chrome binary [chrome #01-1] (Driver info: chromedriver=2.45.615279 (12b89733300bd268cff3b78fc76cb8f3a7cc44e5),platform=Linux 4.14.77-70.59.amzn1.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) [chrome #01-1] Command duration or timeout: 4 milliseconds [chrome #01-1] Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' [chrome #01-1] System info: host: 'ip-10-0-39-73', ip: '10.0.39.73', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.77-70.59.amzn1.x86_64', java.version: '1.8.0_141' [chrome #01-1] Driver info: driver.version: unknown [chrome #01-1] at Object.checkLegacyResponse (C:\Users\User1\Projects\ui-auto.qa\node_modules\selenium-webdriver\lib\error.js:546:15) [chrome #01-1] at parseHttpResponse (C:\Users\User1\Projects\ui-auto.qa\node_modules\selenium-webdriver\lib\http.js:509:13) [chrome #01-1] at doSend.then.response (C:\Users\User1\Projects\ui-auto.qa\node_modules\selenium-webdriver\lib\http.js:441:30) [chrome #01-1] at process._tickCallback (internal/process/next_tick.js:68:7)``` 

Источник

Читайте также:  Linux добавить сетевое устройство

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

I am trying to automate some stuff I do day-to-day online and get some experience in webscraping. I saw some stuff about Selenium and Python being good for beginners and thought I would give it a try. I ended up getting a simple script to work on my home computer but it doesn’t find the Chrome binary at the path I am giving and I do not know what to do. I used this to set my PATH environment variable to the directory that holds my chromedriver https://youtu.be/dz59GsdvUF8 I downloaded ChromeDriver 74.0.3729.6 (latest stable release) from https://sites.google.com/a/chromium.org/chromedriver/ I am using python3, visual studio code, and Ubuntu if any of that matters.

import time from selenium import webdriver from selenium.webdriver.common.keys import Keys #Stack overflow said to try this but could not make it work #opts = webdriver.ChromeOptions() #opts.binary_location = "C:\webdrivers\chromedriver.exe" #browser = webdriver.Chrome(chrome_options=opts) #this is where my chrome is #C:\Users\tucker.steven2\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Virtual Programs\Google Chrome\Chrome v62 #I have a chromedriver in the same directory as my python code browser = webdriver.Chrome('chromedriver.exe') browser.get(https://www.something.com/) #just a generic site browser.quit() 

selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@),platform=Windows NT 10.0.16299 x86_64)

Источник

Оцените статью
Adblock
detector