16

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.<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)
1
  • Can you share your code that creates the ChromeDriver? Commented Apr 7, 2017 at 21:57

5 Answers 5

41

I found the problem. On my linux system, Google Chrome Browser was not installed.

I was under the impression that ChromeDriver binary has got a browser implementation in it. Now I realized that's wrong , ChromeDriver binary is a selenium wrapper that calls Google Chrome.

I must say that the exception message "selenium.WebDriverException: unknown error: cannot find Chrome binary" is confusing. If it was telling that "Chrome Browser is not installed" or something similar it would have been much easier.

Thanks George

Sign up to request clarification or add additional context in comments.

4 Comments

Same on Windows, needed to install Chrome to get it working.
I had the same problem and totally agree. Not only is the error message misleading, it is completely wrong. The driver is installed, the CHROME browser (.executable) is what is missing.
after troubleshooting a bunch of errors on my VPS, i've got it to the point where it's now spitting out that confusing ass error, but i thought to myself maybe it's because Chrome/Chromium isn't installed? this is the first time i've ever used Selenium on a CentOS 7 VPS, not to mention my first time ever using CentOS 7 and a VPS too lol. i'm proud of myself :D i hope installing Chrome/Chromium works for me!!! fingers crossed
I'm getting the same error message although I'm trying to launch the e2e tests on firefox and not on chrome. I have 2 versions of firefox installed on my laptop : the normal firefox and the firefox developer edition. Can it be that he couldn't find any of both ?
3

Pointing to binary location, helped to fix the issue.

Changed from :

capabilities: {
    'browserName': 'chrome'
}

To:

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

Comments

1

Check the version of chrome install on your machine, then download the same version from https://sites.google.com/a/chromium.org/chromedriver/

Comments

0

It is issue with installation of Chrome on my Windows 10. Try to reinstall it on computer you got this issue.

If it will not solve the problem use Gecko driver and Firefox.

Comments

0

You may install Chrome through NPM:

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

npm install chromium

Then, map your chrome binary:

const chromium = require('chromium');

capabilities: [
    {
        browserName: 'chrome',
        'goog:chromeOptions': {
            binary: chromium.path
        },
    },
],

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.