Search code examples
selenium-chromedriverselenium-grid

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.


Solution

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