Nightwatch.js:为什么我得到无法创建新服务:GeckoDriverService?

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

我第一次尝试设置最新的 nightwatch.js。这是我的 nightwatch.js:

{
  "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"
      }
    }
  }
}

当我 运行 守夜时我得到这个错误:

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' },

我该如何解决这个问题?

我假设您正在启动 default 测试设置,它将尝试访问 geckoDriver。

您似乎没有指定驱动程序的路径,"webdriver.chrome.driver" : """webdriver.gecko.driver" : """webdriver.edge.driver" : ""

您需要将它们指向您的驱动程序可执行文件,例如从我的项目: 'webdriver.gecko.driver':'/.selenium/geckodriver/0.19.0-x64-geckodriver'