通过Nightwatch运行Selenium Server时出错

时间:2016-11-06 20:43:40

标签: selenium selenium-webdriver webdriver selenium-chromedriver nightwatch.js

我正在尝试运行一个简单的测试脚本。但是我收到以下错误:

enter image description here

我的nightwatch配置文件设置如下:

nightwatch.conf.js

module.exports = {
  "src_folders": [
    "tests"// Where you are storing your Nightwatch e2e/UAT tests
  ],
  "output_folder": "./reports", // reports (test outcome) output by nightwatch
  "selenium": { 
    "start_process": true, // tells nightwatch to start/stop the selenium process
    "server_path": "./node_modules/selenium-standalone/.selenium/selenium-server/2.53.1-server.jar",
    "host": "127.0.0.1",
    "port": 4444, // standard selenium port
    "cli_args": {       "webdriver.chrome.driver" : "./node_modules/selenium-standalone/.selenium/chromedriver/2.25-x64-chromedriver"
    }
  },
  "test_settings": {
    "default": {
      "screenshots": {
        "enabled": true, // if you want to keep screenshots
        "path": './screenshots' // save screenshots here
      },
      "globals": {
        "waitForConditionTimeout": 5000 // sometimes internet is slow so wait.
      },
      "desiredCapabilities": { // use Chrome as the default browser for tests
        "browserName": "chrome"
      }
    },
    "chrome": {
      "desiredCapabilities": {
        "browserName": "chrome",
        "javascriptEnabled": true // set to false to test progressive enhancement
      }
    }
  }
}

豚鼠pig.js

module.exports = { // addapted from: https://git.io/vodU0
  'Guinea Pig Assert Title': function(browser) {
    browser
      .url('https://saucelabs.com/test/guinea-pig')
      .waitForElementVisible('body')
      .assert.title('I am a page title - Sauce Labs')
      .saveScreenshot('ginea-pig-test.png')
      .end();
  }
};

服务器路径和chromedriver路径是准确的,也是最新的副本。我也安装了最新版本的chrome。有人可以帮我理解可能是什么问题吗?谢谢!

修改:我也重新启动了整台计算机,同样的问题。

2 个答案:

答案 0 :(得分:0)

尝试使用最新版本的Selenium独立服务器v.3.0.1

如果这不起作用,那么您可以将chromedriver升级到最新版本并进行测试。你可以在这里找到不同的版本:

https://chromedriver.storage.googleapis.com/index.html

另外,请确保您使用的是最新版本的Nightwatch v0.9.9并在package.json文件中进行更新。

答案 1 :(得分:0)

写得非常清楚,你的chrome版本低于chromedriver的需求,只需将你的chrome更新到最新版本