kroe761
kroe761

Reputation: 3534

Define location of selenium chromedriver executable in node config json (3.0.1)?

I know I can define the location of the chrome driver executable when I launch a selenium grid node like so:

-jar -Dwebdriver.chrome.driver="C:\chromedriver.exe" selenium-server-standalone-3.0.1.jar -role node -nodeConfig. nodeConfig.json

But how can I define the chromedriver's location in the config file? I tried this:

{
    "capabilities":
[
    {
        "browserName": "chrome",
        "maxInstances": 5,
        "seleniumProtocol": "WebDriver",
        "webdriver.chrome.driver": "C:\chromedriver.exe"
    },
....

But it still fails. Not a huge deal, but trying to move as much of the configuration to the son file and this is the last step to that end.

Upvotes: 0

Views: 2115

Answers (2)

Amado Saladino
Amado Saladino

Reputation: 2672

It worked with me when I added both properties in json config file like this way here: notice the last two lines

{
  "capabilities":
  [
    {
      "browserName": "firefox",
      "marionette": true,
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "chrome",
      "maxInstances": 5,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "internet explorer",
      "platform": "WINDOWS",
      "maxInstances": 1,
      "seleniumProtocol": "WebDriver"
    },
    {
      "browserName": "safari",
      "technologyPreview": false,
      "platform": "MAC",
      "maxInstances": 1,
      "seleniumProtocol": "WebDriver"
    }
  ],
  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
  "maxSession": 5,
  "port": -1,
  "register": true,
  "registerCycle": 5000,
  "hub": "http://192.168.1.2:4444",
  "nodeStatusCheckTimeout": 5000,
  "nodePolling": 5000,
  "role": "node",
  "unregisterIfStillDownAfter": 60000,
  "downPollingLimit": 2,
  "debug": false,
  "servlets" : [],
  "withoutServlets": [],
  "custom": {},
  "webdriver.gecko.driver":"c:/drivers/geckodriver.exe",
  "webdriver.chrome.driver":"c:/drivers/chromedriver.exe"
}

Upvotes: 0

Krishnan Mahadevan
Krishnan Mahadevan

Reputation: 14736

I don't think you can specify the location of your chromedriver in your node configuration JSON file because AFAIK there's no logic in the selenium codebase that basically reads this from the list of capabilities that it gets via the node configuration file.

Instead of trying to put the path of the chromedriver binary in your JSON file, I would recommend that you include the location of the chromedriver binary as part of your PATH variable. ChromeDriver binary presence should ideally speaking be treated as a machine's pre-requisite (just as how you would expect java to be installed or the browsers to be installed)

Upvotes: 1

Related Questions