Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Nightwatch和Selenium测试localhost时无法在Firefox上加载页面_Firefox_Selenium Webdriver_Nightwatch.js_Geckodriver - Fatal编程技术网

使用Nightwatch和Selenium测试localhost时无法在Firefox上加载页面

使用Nightwatch和Selenium测试localhost时无法在Firefox上加载页面,firefox,selenium-webdriver,nightwatch.js,geckodriver,Firefox,Selenium Webdriver,Nightwatch.js,Geckodriver,我正在使用SeleniumWebDriverAPI的节点包装器构建一套自动化集成测试。我能够让它在Chrome上正常工作,但在Firefox(或者Safari)上却不行 我认为问题与GeckoDriver和Firefox驱动程序有关。我已将Nightwatch配置为在我的Nightwatch.json中使用GeckoDriver。但是Selenium似乎在寻找Firefox驱动程序,基于nightwatch-eFirefox--verbose的终端输出。见下文: INFO Request: PO

我正在使用SeleniumWebDriverAPI的节点包装器构建一套自动化集成测试。我能够让它在Chrome上正常工作,但在Firefox(或者Safari)上却不行

我认为问题与GeckoDriver和Firefox驱动程序有关。我已将Nightwatch配置为在我的
Nightwatch.json
中使用GeckoDriver。但是Selenium似乎在寻找Firefox驱动程序,基于
nightwatch-eFirefox--verbose
的终端输出。见下文:

INFO Request: POST /wd/hub/session/2c156cf4-10cb-44b2-8b1f-c12312b4633f/url 
 - data:  {"url":"localhost:9000"} 
 - headers:  {"Content-Type":"application/json; charset=utf-8","Content-Length":24}
ERROR Response 500 POST /wd/hub/session/2c156cf4-10cb-44b2-8b1f-c12312b4633f/url (1218ms) { state: 'unknown error',
  sessionId: '2c156cf4-10cb-44b2-8b1f-c12312b4633f',
  hCode: 1111219279,
  value: 
   { additionalInformation: '\nDriver info: org.openqa.selenium.firefox.FirefoxDriver\nCapabilities ...
这是我的夜视配置文件:

{
  "src_folders": ["./nightwatch/tests"],
  "output_folder": "./nightwatch/reports",
  "custom_commands_path": "",
  "custom_assertions_path": "",
  "page_objects_path": "./nightwatch/tests/pages",
  "globals_path": "",

  "selenium": {
    "start_process": true,
    "server_path": "./nightwatch/selenium-server-standalone-3.4.0.jar",
    "log_path": false,
    "cli_args": {
      "webdriver.chrome.driver": "./nightwatch/drivers/chromedriver",
      "webdriver.gecko.driver": "./nightwatch/drivers/geckodriver"
    }
  },

  "test_settings": {
    "default": {
      "desiredCapabilities": {
        "javascriptEnabled": true,
        "acceptSslCerts": true
      }
    },

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

    "firefox": {
      "desiredCapabilities": {
        "browserName": "firefox",
        "marionette": true
      }
    }
  }
}
下面是我在测试中试图访问的
nightwatch/pages/index.js文件:

module.exports = {
  url: 'localhost:9000',
  elements: {
    // stuff
  }
}

不管它值多少钱,目前我们决定继续使用当前ESR版本的Firefox,它可以与Selenium一起开箱即用

我们用这个新版本的Firefox和新的驱动程序做了一些尝试,但它不够稳定,无法继续

我的建议是安装ESR版本的Firefox,看看是否可以这样工作。如果确实如此,则进入下一步(即,根据最新版本进行测试)