bier hier
bier hier

Reputation: 22520

Nightwatch.js: why do I get Unable to create new service: GeckoDriverService?

I am trying to setup the latest nightwatch.js for the first time. This is my nightwatch.json:

{
  "src_folders" : ["tests"],
  "output_folder" : "reports",
  "custom_commands_path" : "",
  "custom_assertions_path" : "",
  "page_objects_path" : "",
  "globals_path" : "",

  "selenium" : {
    "start_process" : true,
    "server_path" : "selenium-server-standalone-3.8.1.jar",
    "log_path" : "",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "",
      "webdriver.gecko.driver" : "",
      "webdriver.edge.driver" : ""
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "http://localhost",
      "selenium_port"  : 4444,
      "selenium_host"  : "localhost",
      "silent": true,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "desiredCapabilities": {
        "browserName": "firefox",
        "marionette": true
      }
    },

    "chrome" : {
      "desiredCapabilities": {
        "browserName": "chrome"
      }
    },

    "edge" : {
      "desiredCapabilities": {
        "browserName": "MicrosoftEdge"
      }
    }
  }
}

When I run nightwatch I get this error:

Starting selenium server... started - PID:  3176

[Go] Test Suite
===================

Running:  Demo test

Error retrieving a new session from the selenium server

Connection refused! Is selenium server started?
{ value:
   { message: 'Unable to create new service: GeckoDriverService\nBuild info: ve
sion: \'3.8.1\', revision: \'6e95a6684b\', time: \'2017-12-01T19:05:32.194Z\'\n
ystem info: host: \'S0026COW1983\', ip: \'10.39.13.81\', os.name: \'Windows Ser
er 2008 R2\', os.arch: \'x86\', os.version: \'6.1\', java.version: \'1.8.0_131\
\nDriver info: driver.version: unknown',
     error: 'session not created' },

How can I resolve this?

Upvotes: 1

Views: 2397

Answers (1)

Stratos Ion
Stratos Ion

Reputation: 628

I will assume that you are launching the default test settings which will try to access geckoDriver.

Looks like you haven't specified the paths for your drivers, "webdriver.chrome.driver" : "", "webdriver.gecko.driver" : "", "webdriver.edge.driver" : ""

You need to point those to your driver executables, e.g. from my project: 'webdriver.gecko.driver':'/.selenium/geckodriver/0.19.0-x64-geckodriver'

Upvotes: 3

Related Questions