Selenium gives “unknown error: cannot find chrome binary” when running chrome driver on Ubuntu

I am trying to run selenium [java] tests using the chrome driver on the last node. [16.04]

I get the following error / exception. As an experiment, I replaced the ChromeDriver binary with my native "helloworldApp"; I found that selenium is executing my binary.

I believe the print "Running ChromeDriver 2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320) on port 15306" comes from the chrome binary. But why does selenium complain that it cannot get binary code?

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.<init>(RemoteWebDriver.java:131) [java] at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144) [java] at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170) [java] at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138) 
+9
source share
5 answers

I found a problem. Google Chrome was not installed on my Linux system.

I got the impression that the ChromeDriver binary implements a browser implementation. Now I realized what’s wrong, the ChromeDriver binary is a selenium shell that calls Google Chrome.

I have to say that the exception message " selenium.WebDriverException: unknown error: cannot find the Chrome binary is confused. If he said" Chrome browser is not installed "or something like that, it would be much simpler.

Thanks George

+31
source

Pointing out the binary location helped solve the problem.

Changed from:

 capabilities: { 'browserName': 'chrome' } 

In order to:

 capabilities: { 'browserName': 'chrome', "chromeOptions": { 'binary': "C:\\Program Files (x86)\\Google\\Chrome Beta\\Application\\chrome.exe", args: [], extensions: [], } 
+1
source

If your Chrome is not installed in the standard location, you may have to explicitly specify it in the protractor.conf.js file:

 capabilities: { 'browserName': 'chrome', "chromeOptions": { binary: "/Applications/your_path/Google Chrome.app/Contents/MacOS/Google Chrome" }, }, 

OR

You can use chromeoptions :

 ChromeOptions ChromeOptions = new ChromeOptions(); ChromeOptions.addArguments("--headless", "window-size=1024,768", "--no-sandbox"); driver = new ChromeDriver(ChromeOptions); 
0
source

You can install Chrome via NPM:

https://www.npmjs.com/package/chromium

NPM install chrome

Then map your Chrome binary:

 const chromium = require('chromium'); capabilities: [ { browserName: 'chrome', 'goog:chromeOptions': { binary: chromium.path }, }, ], 
0
source

This is a problem with installing Chrome on my Windows 10. Try reinstalling it on your computer, you have this problem.

If this does not solve the problem, use the Gecko driver and Firefox.

-1
source

Source: https://habr.com/ru/post/1273788/


All Articles