Unknown error cannot find chrome binary linux

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 "

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. unknown error: cannot find Chrome binary #177
  2. Comments
  3. Footer
  4. WebDriverError: unknown error: cannot find Chrome binary #3614
  5. Comments
  6. Fix: Selenium’s “cannot find Chrome binary” Error
  7. Reason
  8. Possible Fixes

unknown error: cannot find Chrome binary #177

Cannot find Chrome binary when executing a selenium (testng) test in jenkins on Ubuntu

org.openqa.selenium.WebDriverException:
unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.10.0-37-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9 milliseconds
Build info: version: ‘3.4.0’, revision: ‘unknown’, time: ‘unknown’
System info: host: ‘automation-tests-desktop’, ip: ‘127.0.1.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.10.0-37-generic’, java.version: ‘1.8.0_151’
Driver info: driver.version: ChromeDriver

The text was updated successfully, but these errors were encountered:

Install Chrome on Jenkins. Typically, you will need Xvfb (X virtual framebuffer) too.

File «/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py», line 312, in execute
self.error_handler.check_response(response)
File «/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py», line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.30,platform=Linux 3.10.0-693.17.1.el7.x86_64 x86_64)

org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.4.35-33.55.amzn1.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 19 milliseconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:01:39.354Z’
System info: host: ‘Unknown’, ip: ‘Unknown’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.4.35-33.55.amzn1.x86_64’, java.version: ‘1.8.0_151’
Driver info: driver.version: ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123)
at Driver.driver.init(driver.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:451)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:163)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
at org.testng.TestNG.runSuites(TestNG.java:1028)
at org.testng.TestNG.run(TestNG.java:996)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:90)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

@ChandraShekarReddy1996 i have the same problem, did you solve it?

Any solution yet? I have similar problem
selenium.common.exceptions.WebDriverException: Message: unknown error: no chrome binary

For java, I found that answer very helpful:

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

WebDriverError: unknown error: cannot find Chrome binary #3614

I use protractor with a standalone Selenium Server and chrome browser
It work fine when I use Windows windows 7 but for Linux Binary chrome cannot be found.

I specified the binary’s path in attribute ‘chromeDriver’ for :

  • ‘./node_modules/webdriver-manager/selenium/chromedriver_2.22.exe’ (for Windows 7)** 👍
  • ‘./node_modules/webdriver-manager/selenium/chromedriver_2.22) (for Linux) 👎

I create 2 task in my gulptask file, one for update webdriver, and the other one to launch my tests.
These tasks are launched synchronously when webdriver-update is finish I launch my tests.

When I launch my tasks on Linux WebDriver cannot find Chrome binary

Download and unzip a this location by the task webdriver-update:
./node_modules/webdriver-manager/selenium/chromedriver_2.22linux64.zip

Protractor configuration file.
chromeDriver: ‘./node_modules/webdriver-manager/selenium/chromedriver_2.22’

[15:50:08] Using gulpfile /builds/lcab/lcab/Gulpfile.js
[15:50:08] Starting ‘protractor’.
[15:50:08] Starting ‘webdriver-update’.
webdriver-manager: using local installed version 10.2.3
[15:50:08] I/update — selenium standalone: file exists /builds/lcab/lcab/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar
[15:50:08] I/update — selenium standalone: v2.53.1 up to date
[15:50:08] I/update — chromedriver: file exists /builds/lcab/lcab/node_modules/webdriver-manager/selenium/chromedriver_2.22linux64.zip
[15:50:08] I/update — chromedriver: unzipping chromedriver_2.22linux64.zip
[15:50:09] I/update — chromedriver: setting permissions to 0755 for /builds/lcab/lcab/node_modules/webdriver-manager/selenium/chromedriver_2.22
[15:50:09] I/update — chromedriver: v2.22 up to date
[15:50:09] Finished ‘webdriver-update’ after 698 ms
[15:50:09] Starting ‘e2e-tests’.
[15:50:09] D/launcher — Running with —troubleshoot
[15:50:09] D/launcher — Protractor version: 4.0.9
[15:50:09] D/launcher — Your base url for tests is http://.
[15:50:09] I/direct — Using ChromeDriver directly.
[15:50:09] I/launcher — Running 1 instances of WebDriver
[15:50:09] E/launcher — unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.22.397932 (282ed7cf89cf0053b6542e0d0f039d4123bbb6ad),platform=Linux 4.7.0-coreos x86_64)
[15:50:09] E/launcher — WebDriverError: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.22.397932 (282ed7cf89cf0053b6542e0d0f039d4123bbb6ad),platform=Linux 4.7.0-coreos x86_64)
at WebDriverError (/builds/lcab/lcab/node_modules/selenium-webdriver/lib/error.js:27:5)
at Object.checkLegacyResponse (/builds/lcab/lcab/node_modules/selenium-webdriver/lib/error.js:639:15)
at parseHttpResponse (/builds/lcab/lcab/node_modules/selenium-webdriver/http/index.js:538:13)
at client_.send.then.response (/builds/lcab/lcab/node_modules/selenium-webdriver/http/index.js:472:11)
at ManagedPromise.invokeCallback_ (/builds/lcab/lcab/node_modules/selenium-webdriver/lib/promise.js:1379:14)
at TaskQueue.execute_ (/builds/lcab/lcab/node_modules/selenium-webdriver/lib/promise.js:2913:14)
at TaskQueue.executeNext_ (/builds/lcab/lcab/node_modules/selenium-webdriver/lib/promise.js:2896:21)
at asyncRun (/builds/lcab/lcab/node_modules/selenium-webdriver/lib/promise.js:2820:25)
at /builds/lcab/lcab/node_modules/selenium-webdriver/lib/promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.createSession()
at Function.createSession (/builds/lcab/lcab/node_modules/selenium-webdriver/lib/webdriver.js:329:24)
at Driver (/builds/lcab/lcab/node_modules/selenium-webdriver/chrome.js:778:38)
at Direct.getNewDriver (/builds/lcab/lcab/node_modules/protractor/built/driverProviders/direct.js:68:26)
at Runner.createBrowser (/builds/lcab/lcab/node_modules/protractor/built/runner.js:198:43)
at /builds/lcab/lcab/node_modules/protractor/built/runner.js:277:30
at _fulfilled (/builds/lcab/lcab/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/builds/lcab/lcab/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/builds/lcab/lcab/node_modules/q/q.js:796:13)
at /builds/lcab/lcab/node_modules/q/q.js:556:49
at runSingle (/builds/lcab/lcab/node_modules/q/q.js:137:13)
[15:50:09] E/launcher — Process exited with error code 199

/builds/lcab/lcab/app/Resources/gulpFiles/unitsTestingFront.js:52
throw e;
^
Error: protractor exited with code 199
ERROR: Build failed: exit code 1`

my protractor conf file

I’v tried to install chromedriver in nodes modules and add the chrome binary path to chromedriver attribute but it work only on window and I also try to add this conf to protractor but it seem to be deprecated :

The text was updated successfully, but these errors were encountered:

Источник

Fix: Selenium’s “cannot find Chrome binary” Error

Skip to entry content

You fire up your Selenium-based Chrome browser automation operation(s) one fine day and you are greeted with a godawful bit of an exception, at the bottom of which you read the following:

Puzzled, “It was working optimally just yesterday!”, you think to yourself, wondering what the variable causing this could be. The infamously trusty Stack Overflow does not tell you much about this, except that you probably need to explicitly set the Google Chrome binary’s path as so:

But, “dude”—you ask yourself—”why should I explicitly set the Google Chrome binary’s path?” or maybe “Why was this not required just yesterday?”

Well, for the curious minds that made it here, may you have the strength of a thousand Suns, for we are a different people that consist of special gears in our heads that start “churning” once an inconsistency makes its way into our lives; and instead of just “fixing” the capsizing ship with a chunky roll of Flex tape (not sponsored) over the cracks and holes, we would like to know how it happened, what made it happen, and why it happened—as we abandon ship and auto-inflate our enormous life raft (using Selenium, of course, ’cause “automation”) and then sail off into the sunset as we code an Apache helicopter into existence (what ship? Pfft).

Now if there’s one thing you can be sure of, it’s that nothing is more powerful than a young boy’s wish. Except an Apache helicopter. An Apache helicopter has machine guns AND missiles. It is an unbelievably impressive complement of weaponry, an absolute death machine. ” —Morgan-Freeman-sounding-but-not-Morgan-Freeman narrator — Ted (2012)

We have digressed far into the 3.5 th dimension here; apologies, here’s the reason and possible fix!

Reason

NOTE: Just for the sake of clarity, this “Chrome binary” that Selenium is referring to is simply the OG big daddy main “Chrome.exe” file located in Google Chrome’s installation directory.

In previous versions of Google Chrome (v84 and below), Google Chrome’s default installation path—where “Chrome.exe” typically is—used to be:

But since the newer iteration(s) (v85 and above), the default installation path is:

Now, this is the problem. Where the older chromedriver.exe versions (v84 and below) intuitively expect the Chrome binary to be is in the former path, not the latter. If your Google Chrome browser naturally auto-updated from v84 to v85, this path remains unchanged (so chromedriver.exe has no issues navigating to it). However, if you explicitly installed or reinstalled Google Chrome on the latest version (v85 and above) recently, then the installation path changes to the newer one, and so, your older chromedriver.exe is not able to navigate to the Chrome binary; and this makes your code end with that particular “cannot find Chrome binary” exception. Ergo, this is why you are having to explicitly set the “binary_location” to the latter manually

NOTE: Since Google Chrome does not allow customizing the installation path while installing and just directly installs into Program Files by default, We have already tried a workaround and changed the default installation path itself from the registry (regedit); but to no avail, Google Chrome would then completely refuse to work once installed in the desired directory. It seems newer Google Chrome installations can only function if they are installed in the newer installation path.

Possible Fixes

Download the latest chromedriver.exe version that corresponds to your Google Chrome version (from here ), and replace your existing chromedriver.exe with this new one.

Your problem should now be solved, since the newer chromedriver.exe is equipped with the knowledge that the new Google Chrome installation path is where it is supposed to look in order to find the Chrome binary.

But—for whatever reason—if you do not want to upgrade the chromedriver.exe version, you could just downgrade your Google Chrome version by obtaining an older version that corresponds to your chromedriver.exe version, uninstalling the newer version, and then installing the older version you had obtained.

NOTE: You will not find any official downloads for older Google Chrome versions since Google does not allow this for security reasons, but you may find some unofficial sources like this (personally tested and verified, safe). Also be informed that upon installing an older version of Google Chrome, auto-updates will no longer work anymore; so the only way for a potential future update would be via an uninstall and manual install of the latest Google Chrome version.

Источник

@IroshR

Cannot find Chrome binary when executing a selenium (testng) test in jenkins on Ubuntu

org.openqa.selenium.WebDriverException:
unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.33.506092 (733a02544d189eeb751fe0d7ddca79a0ee28cce4),platform=Linux 4.10.0-37-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 9 milliseconds
Build info: version: ‘3.4.0’, revision: ‘unknown’, time: ‘unknown’
System info: host: ‘automation-tests-desktop’, ip: ‘127.0.1.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.10.0-37-generic’, java.version: ‘1.8.0_151’
Driver info: driver.version: ChromeDriver

@bonigarcia

Install Chrome on Jenkins. Typically, you will need Xvfb (X virtual framebuffer) too.

@lovezeropython

File «/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py», line 312, in execute
self.error_handler.check_response(response)
File «/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py», line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.30,platform=Linux 3.10.0-693.17.1.el7.x86_64 x86_64)

Centos

@ChandraShekarReddy1996

org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.4.35-33.55.amzn1.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 19 milliseconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:01:39.354Z’
System info: host: ‘Unknown’, ip: ‘Unknown’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.4.35-33.55.amzn1.x86_64’, java.version: ‘1.8.0_151’
Driver info: driver.version: ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123)
at Driver.driver.init(driver.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:451)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:163)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
at org.testng.TestNG.runSuites(TestNG.java:1028)
at org.testng.TestNG.run(TestNG.java:996)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:295)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:84)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:90)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

@BITOCTA

@pradgnyak

Any solution yet? I have similar problem
selenium.common.exceptions.WebDriverException: Message: unknown error: no chrome binary

@Bick95

Issue

Had been trying to configure and have met with a lot of trouble, tried a lot of attempt but failed.

  • chromedriver=2.30.477691
  • Chrome 59.0.3071.115
  • Build info: version: ‘3.14.0’
  • Selenium 3.4
  • java.version: ‘1.8.0_121’
  • Linux 3.10.0-229.4.2.el7.x86_64 x86_64

Error:

unknown error: cannot find Chrome binary   (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 3.10.0-229.4.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 59 milliseconds Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' System info: host: '8f5b40c32460', ip: 'x', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121' Driver info: driver.version: ChromeDriver

Solution

This error message…

unknown error: cannot find Chrome binary   (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 3.10.0-229.4.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 59 milliseconds Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' System info: host: '8f5b40c32460', ip: 'x', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121' Driver info: driver.version: ChromeDriver

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

  • You are using chromedriver=2.30
  • Release Notes of chromedriver=2.30 clearly mentions the following :

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

Ensure that:

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

Answered By — DebanjanB

You fire up your Selenium-based Chrome browser automation operation(s) one fine day and you are greeted with a godawful bit of an exception, at the bottom of which you read the following:

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

Puzzled, “It was working optimally just yesterday!”, you think to yourself, wondering what the variable causing this could be. The infamously trusty Stack Overflow does not tell you much about this, except that you probably need to explicitly set the Google Chrome binary’s path as so:

...
chromeOptions = webdriver.ChromeOptions()
chromeOptions.binary_location = "C:Program
FilesGoogleChromeApplication" chromeDriver = "/chromedriver.exe"
driver = webdriver.Chrome(chromeDriver, options=chromeOptions)
...

But, “dude”—you ask yourself—”why should I explicitly set the Google Chrome binary’s path?” or maybe “Why was this not required just yesterday?”

Well, for the curious minds that made it here, may you have the strength of a thousand Suns, for we are a different people that consist of special gears in our heads that start “churning” once an inconsistency makes its way into our lives; and instead of just “fixing” the capsizing ship with a chunky roll of Flex tape (not sponsored) over the cracks and holes, we would like to know how it happened, what made it happen, and why it happened—as we abandon ship and auto-inflate our enormous life raft (using Selenium, of course, ’cause “automation”) and then sail off into the sunset as we code an Apache helicopter into existence (what ship? Pfft).

Now if there’s one thing you can be sure of, it’s that nothing is more powerful than a young boy’s wish. Except an Apache helicopter. An Apache helicopter has machine guns AND missiles. It is an unbelievably impressive complement of weaponry, an absolute death machine.” —Morgan-Freeman-sounding-but-not-Morgan-Freeman narrator — Ted (2012)

We have digressed far into the 3.5th dimension here; apologies, here’s the reason and possible fix!

Reason

NOTE: Just for the sake of clarity, this “Chrome binary” that Selenium is referring to is simply the OG big daddy main “Chrome.exe” file located in Google Chrome’s installation directory.

In previous versions of Google Chrome (v84 and below), Google Chrome’s default installation path—where “Chrome.exe” typically is—used to be:

C:UsersUSERNAMEAppDataLocalGoogle

But since the newer iteration(s) (v85 and above), the default installation path is:

C:Program FilesGoogle

Now, this is the problem. Where the older chromedriver.exe versions (v84 and below) intuitively expect the Chrome binary to be is in the former path, not the latter. If your Google Chrome browser naturally auto-updated from v84 to v85, this path remains unchanged (so chromedriver.exe has no issues navigating to it). However, if you explicitly installed or reinstalled Google Chrome on the latest version (v85 and above) recently, then the installation path changes to the newer one, and so, your older chromedriver.exe is not able to navigate to the Chrome binary; and this makes your code end with that particular “cannot find Chrome binary” exception. Ergo, this is why you are having to explicitly set the “binary_location” to the latter manually

NOTE: Since Google Chrome does not allow customizing the installation path while installing and just directly installs into Program Files by default, We have already tried a workaround and changed the default installation path itself from the registry (regedit); but to no avail, Google Chrome would then completely refuse to work once installed in the desired directory. It seems newer Google Chrome installations can only function if they are installed in the newer installation path.

Possible Fixes

Download the latest chromedriver.exe version that corresponds to your Google Chrome version (from here), and replace your existing chromedriver.exe with this new one.

Your problem should now be solved, since the newer chromedriver.exe is equipped with the knowledge that the new Google Chrome installation path is where it is supposed to look in order to find the Chrome binary.

But—for whatever reason—if you do not want to upgrade the chromedriver.exe version, you could just downgrade your Google Chrome version by obtaining an older version that corresponds to your chromedriver.exe version, uninstalling the newer version, and then installing the older version you had obtained.

NOTE: You will not find any official downloads for older Google Chrome versions since Google does not allow this for security reasons, but you may find some unofficial sources like this (personally tested and verified, safe). Also be informed that upon installing an older version of Google Chrome, auto-updates will no longer work anymore; so the only way for a potential future update would be via an uninstall and manual install of the latest Google Chrome version.

For Linux system, running Selnium script will report the following error

Traceback (most recent call last):
  File "./obp_pb_get_csv.py", line 73, in <module>
    browser = webdriver.Chrome('/usr/bin/chromium') # Get local session of chrome
  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 46, in __init__
    self.service.start()
  File "/usr/lib64/python2.7/site-packages/selenium/webdriver/chrome/service.py", line 64, in start
    raise WebDriverException("Can not connect to the ChromeDriver")
selenium.common.exceptions.WebDriverException: Message: 'Can not connect to the ChromeDriver'

Solution:

1. Confirm whether Chrome browser is installed, command: Chrome browser - version 0

2. If not, use the following command to install: sudo apt get install chromium browser

3. Get chromedriver and visit the following link http://chromedriver.storage.googleapis.com/index.html

4. Decompress Chromdriver.zip

5. Move the file to the path/usr/bin, command: sudo MV chromedriver/usr/bin

6. Switch to/usr/bin directory, command: CD/usr/bin

7. Make it executable, command: sudo Chmod a + X chromedriver

8. Perform the following code tests:

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("http://www.google.com")
print driver.page_source.encode('utf-8')
driver.quit()
display.stop()

Read More:

  • Solve selenium error — unknown error: devtoolsactivport file doesn’t exist
  • Selenium driver chrome failed to start and reported an error
  • [Solved] selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn
  • Using selenium server- standalone.jar Console error: unknown error: cannot get automation extension solution
  • how to install chrome in kali linux
  • How To Install Google Chrome on Linux Mint 19
  • Solve cannot execute binary file: exec format error under Linux
  • ubuntu-how to solve the error-Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release
  • [solution] Google Chrome browser hijacked by hao123 chrome://version Command line tampered
  • launch failed.Binary Not found in Linux / Ubuntu solution
  • Get picture captcha with Python + Chrome
  • Solution of selenium driven edge error reporting
  • PySpark ERROR Shell: Failed to locate the winutils binary in the hadoop binary path
  • Open the top left corner of the chrome page to display the volume and playback chrome.exe Problem solving
  • Linux find file text command (find | grep)
  • To solve the running error of eclipse for C / C + +: launch failed binary not found
  • How to solve the problem of Cannot find module’npmlog’ when installing nodejs under Linux
  • Error reporting using selenium in pycharm
  • Common linux commands — find command’s Exec
  • Linux c running error killed

Issue

I’m trying to run my test (Selenium+junit+cucumber+Maven) on Jenkins.
In my definition class I’m not pointing to Chrome binary but rather use WebDriverManager:

@Given(«^I navigate to page$»)

public void i_navigate_to_webpage() throws Throwable {

    String url = Helper.getPropValue("landing", "navigation");

    WebDriverManager.chromedriver().setup();
    driver = new ChromeDriver();
    wait = new WebDriverWait(driver,20);

    driver.manage().window().maximize();
    driver.get(url);

}

It works fine on my machine (Win), but when I’m trying to execute this on Jenkins (Ubuntu box), I get error:

org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.4.0-1047-aws x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 687 milliseconds
Build info: version: ‘2.48.2’, revision: ’41bccdd10cf2c0560f637404c2d96164b67d9d67′, time: ‘2015-10-09 13:08:06’
System info: host: ‘ip-172-31-12-150’, ip: ‘172.31.12.150’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.4.0-1047-aws’, java.version: ‘1.8.0_151’
Driver info: org.openqa.selenium.chrome.ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:159)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:116)
at GridTest.grid.StepDef.i_navigate_to_webpage(StepDef.java:52)
at ✽.Given I navigate to page(src/test/test.feature:6)

I was under impression that WebDriverManager should have covered that how it does on my Windows machine. Isn’t it so?

My Pom.xml file here:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>GridTest</groupId>
  <artifactId>grid</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>grid</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <suiteXmlFile>testing.xml</suiteXmlFile>
  </properties>
  <build>
    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>
                                        com.lazerycode.selenium
                                    </groupId>
                                    <artifactId>
                                        driver-binary-downloader-maven-plugin
                                    </artifactId>
                                    <versionRange>
                                        [1.0.17,)
                                    </versionRange>
                                    <goals>
                                        <goal>selenium</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20.1</version>
            </plugin>
        </plugins>
    </pluginManagement>
  </build>
    <dependencies>
    <dependency>
   <groupId>io.github.bonigarcia</groupId>
   <artifactId>webdrivermanager</artifactId>
    <version>2.1.0</version>
    </dependency>
    <dependency>
        <groupId>com.vimalselvam</groupId>
        <artifactId>cucumber-extentsreport</artifactId>
        <version>3.0.2</version>
    </dependency>
    <dependency>
        <groupId>com.aventstack</groupId>
        <artifactId>extentreports</artifactId>
        <version>3.1.1</version>
    </dependency>
    <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>4.12</version>
         <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.1</version>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>1.2.2</version>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.2</version>
    </dependency>
   <dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-core</artifactId>
    <version>1.2.2</version>
  </dependency>
  <dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-chrome-driver</artifactId>
    <version>2.48.2</version>
  </dependency>

  </dependencies>
</project>

Solution

Your chrome on Ubuntu is not installed into default location:

enter image description here

More detail

you can add the chrome binary to PATH environent variable or reinstall it to default location.

Make sure chromedriver compatible with chrome browser, check this link to get compatible mapping

Chromedriver 2.35 Supports Chrome v62-64

When run script from Linux terminal tunnel, like run by Jenkins.
In general, Linux terminal tunnel not have display screen, but run script with headful model require a physical or virtual display.

Option 1: run with headless model when not setup virtual display by xWindow/xvbf

ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
// Must maximize Chrome by `start-maximized`
options.addArguments("start-maximized");

//Dont maximize Chrome by below line, because has no display
driver.manage().window().maximize()

Option 2: run with headful model, but need setup virtual display for the user which Jenkins used to connect to your Ubuntu box or you setup for all users
if you can’t know which user.

Please read document about Xvbf or other xWindow to setup virtual display.

Answered By — yong
Answer Checked By — Marie Seifert (JavaFixing Admin)

Issue

Had been trying to configure and have met with a lot of trouble, tried a lot of attempt but failed.

  • chromedriver=2.30.477691
  • Chrome 59.0.3071.115
  • Build info: version: ‘3.14.0’
  • Selenium 3.4
  • java.version: ‘1.8.0_121’
  • Linux 3.10.0-229.4.2.el7.x86_64 x86_64

Error:

unknown error: cannot find Chrome binary   (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 3.10.0-229.4.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 59 milliseconds Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' System info: host: '8f5b40c32460', ip: 'x', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121' Driver info: driver.version: ChromeDriver

Solution

This error message…

unknown error: cannot find Chrome binary   (Driver info: chromedriver=2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57),platform=Linux 3.10.0-229.4.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 59 milliseconds Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' System info: host: '8f5b40c32460', ip: 'x', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.4.2.el7.x86_64', java.version: '1.8.0_121' Driver info: driver.version: ChromeDriver

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

  • You are using chromedriver=2.30
  • Release Notes of chromedriver=2.30 clearly mentions the following :

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

Ensure that:

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

Answered By – DebanjanB

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Понравилась статья? Поделить с друзьями:
  • Unknown error 80ff0003 canon dr 2010c
  • Unknown error 5402
  • Unknown error 400
  • Unknown error 302123 мегафон
  • Unknown error 234