0

I'm using Selenium with Java and executing tests with JUnit. It keeps telling me

cannot find Chrome binary

Binary location is not standard because I need to test multiple versions. I precise that Chrome.exe launcher exists at specified JSON location...
It looks like the driver still searching at the standard location.

I've got the JSON configuration file:

{
   "capabilities":[
      {
         "browserName":"chrome",
         "platform":"WINDOWS",
         "chromeOptions":{
            "binary":"C:/path/chrome_binary.exe"
         },
         "maxInstance":1
      }
   ],
   "configuration":{
      "cleanUpCycle":2000,
      "timeout":30000,
      "register":true,
      "hubPort":4444,
      "hubHost":"hub.location.net",
      "maxSessions":1
   }
}

As you can see I'm on Windows so I tried path with slashes and backslashes but it doesn't work in either way.
ChromeOptions object should be okay, I used this official documentation

Command line is:

java -jar selenium-server-standalone.jar -role webdriver -nodeConfig path/to/conf.json -Dwebdriver.chrome.driver=path/to/chromedriver.exe

In the code, I'm creating RemoteWebDriver objects and I'm only passing browser, version and platform. It works well with Firefox. For example in JSON node configuration I've got the firefox_binary set and in code, I don't pass it to DesiredCapabilities. Selenium can still use the remote web driver I launched with the command above.

Thanks !

buzz2buzz
  • 163
  • 3
  • 16

3 Answers3

1

Finally got it. Didn't see it on any documentation as they all talk about binary or chromeOptions.

The answer was here https://stackoverflow.com/a/33151376/4675568, many thanks to him and in a nutshell: No chromeOptions, just chrome_binary key like firefox.

"capabilities": [{
  "browserName": "chrome",
  "platform": "WINDOWS",
  "chrome_binary":"C:/path/to/chrome_binary.exe",
  "maxInstance":1
}]
Community
  • 1
  • 1
buzz2buzz
  • 163
  • 3
  • 16
0

maybe should work it apply this change

"binary":"C://path//chromedriver.exe"

EDIT 1

try with this JSON configuration file:

{
   "capabilities":[
      {
         "browserName":"chrome",
         "platform":"WINDOWS",
         "binary":"C:/path/chrome_binary.exe"
         "maxInstance":1
      }
   ],
   "configuration":{
      "cleanUpCycle":2000,
      "timeout":30000,
      "register":true,
      "hubPort":4444,
      "hubHost":"hub.location.net",
      "maxSessions":1
   }
}

eventually, try also to escape the "/" as examples below:

"binary":"C://path//chrome_binary.exe"

or

"binary":"C:\/path\/chrome_binary.exe"
ddb
  • 2,423
  • 7
  • 28
  • 38
0

Paths in Windows use backward slashes:

"binary":"C:\\path\\chrome_binary.exe"
Gideon Pyzer
  • 22,610
  • 7
  • 62
  • 68