Unable to create new service: GeckoDriverService

11,323

Solution 1

No, it is not mandatory. The driver can be anywhere, as long as it is reachable. In your first example, try putting ./ before the executable to explicitly point they're in the same directory as your JSON, like this:

 "cli_args" : {
  "webdriver.chrome.driver" : "./chromedriver.exe",
  "webdriver.gecko.driver" : "./geckodriver.exe",
  "webdriver.firefox.profile" : ""
}

Solution 2

I solved it by putting the driver (chromedriver and/or geckodriver) to the same folder where Selenium is located and changed the json file to

"webdriver.chrome.driver" : "C:/Projects/selenium/chromedriver.exe",
"webdriver.gecko.driver" : "C:/Projects/selenium/geckodriver.exe",

You can put the path anywhere as long as it is reachable.

Share:
11,323
user2018
Author by

user2018

Apparently, I prefer to keep an air of mystery about myself.

Updated on June 17, 2022

Comments

  • user2018
    user2018 almost 2 years

    I am a beginner in Web Automation. I tried to run the Nightwatch tutorial from This YouTube Tutorial.

    I have installed the following tools on Windows 10:

    • node.js
    • selenium-server-standalone-3.9.1
    • nightwatch.js 0.9.19

    When I execute command

    node nightwatch.js -t tests/google.js

    I got an error

    '{ value: { message: 'Unable to create new service: GeckoDriverService\nBuild info: version: \'3.9.1\', revision: \'63f7b50\', time: \'2018-02-07T22:42:28.403Z\'\nSystem info: host: \'DESKTOP-I986AE6\', ip: \'172.29.218.145\', os.name: \'Windows 10\', os.arch: \'amd64\', os.version: \'10.0\', java.version: \'9.0.4\'\nDriver info: driver.version: unknown',
     error: 'session not created' },status: 33 }
    

    I have seen This Post. Then I downloaded the drivers (geckodriver and chromedriver) and put the drivers on the same directory as my json file. Then I insert the path of the driver on the json file, but I still got the same error. How do I fix this?

    My nightwatch.json file:

    {
      "src_folders" : ["tests"],
      "output_folder" : "reports",
      "custom_commands_path" : "",
      "page_objects_path" : "",
      "custom_assertions_path" : "",
      "globals_path" : "",
      "live_output" : false,
      "parallel_process_delay" : 10,
      "disable_colors": false,
      "test_workers" : false,
    
      "selenium" : {
        "start_process" : false,
        "server_path" : "",
        "log_path" : "",
        "host" : "127.0.0.1",
        "port" : 4445,
        "cli_args" : {
          "webdriver.chrome.driver" : "chromedriver.exe",
          "webdriver.gecko.driver" : "geckodriver.exe",
          "webdriver.firefox.profile" : ""
        }
      },
    
      "test_settings" : {
        "default" : {
          "launch_url" : "http://localhost",
          "selenium_host" : "127.0.0.1",
          "selenium_port" : 4444,
          "silent" : true,
          "disable_colors": false,
          "screenshots" : {
            "enabled" : false,
            "path" : ""
          },
          "desiredCapabilities" : {
            "browserName" : "firefox",
            "javascriptEnabled" : true,
            "acceptSslCerts" : true
          }
        },
    
        "saucelabs" : {
          "selenium_host" : "ondemand.saucelabs.com",
          "selenium_port" : 80,
          "username" : "${SAUCE_USERNAME}",
          "access_key" : "${SAUCE_ACCESS_KEY}",
          "use_ssl" : false,
          "silent" : true,
          "output" : true,
          "screenshots" : {
            "enabled" : false,
            "on_failure" : true,
            "path" : ""
          },
          "desiredCapabilities": {
            "name" : "test-example",
            "browserName": "firefox"
          },
          "globals" : {
            "myGlobal" : "some_sauce_global"
          },
          "selenium" : {
            "start_process" : false
          }
        },
    
        "phantomjs" : {
          "desiredCapabilities" : {
            "browserName" : "phantomjs",
            "javascriptEnabled" : true,
            "acceptSslCerts" : true,
            "phantomjs.binary.path" : "/path/to/phantomjs"
          }
        },
    
        "browserstack" : {
          "selenium" : {
            "start_process" : false
          },
          "selenium_host" : "hub.browserstack.com",
          "selenium_port" : 80,
          "silent" : true,
          "desiredCapabilities": {
            "name" : "test-example",
            "browserName": "firefox",
            "browserstack.user" : "...",
            "browserstack.key" : "..."
          }
        },
    
        "testingbot" : {
          "selenium_host" : "hub.testingbot.com",
          "selenium_port" : 80,
          "apiKey" : "${TB_KEY}",
          "apiSecret" : "${TB_SECRET}",
          "silent" : true,
          "output" : true,
          "screenshots" : {
            "enabled" : false,
            "on_failure" : true,
            "path" : ""
          },
          "desiredCapabilities": {
            "name" : "test-example",
            "browserName": "firefox"
          },
          "selenium" : {
            "start_process" : false
          }
        }
      }
    }