Nightwatch.js 使用 Chrome 驱动程序、Selenium 进行日志配置

Nightwatch.js log config with Chrome Driver, Selenium

我是 运行 节点 nightwatch.js,具有 Chrome 驱动程序和 Selenium

nightwatch.json 中的配置似乎不起作用

"test_settings": {
    "default": {
        "desiredCapabilities": {
            "loggingPrefs": {
            "browser":     "ALL",
            "driver":      "ALL",
            "performance": "ALL",
            "server": "OFF"
        }
    }
}

终于成功了

"silent": true

就这么简单

你能post你的整个配置文件吗?

desiredCapabilities 错误,请按照此配置设置正确的 nightwatch.conf.js,您需要将 chromedriver 位置更改为您的位置。

const SCREENSHOT_PATH = "./screenshots/";
const BINPATH = './node_modules/nightwatch/bin/';

// we use a nightwatch.conf.js file so we can include comments and helper functions
module.exports = {
  "src_folders": [
    "scripts/test"// Where you are storing your Nightwatch e2e tests
  ],
  "output_folder": "./reports", // reports (test outcome) output by nightwatch
  "selenium": { // downloaded by selenium-download module (see readme)
    "start_process": true, // tells nightwatch to start/stop the selenium process
    "server_path": "./node_modules/nightwatch/bin/selenium.jar", // the standard alone selenium server jar
    "host": "127.0.0.1",
    "port": 4444, // standard selenium port
    "cli_args": { // chromedriver is downloaded by selenium-download (see readme)

      "webdriver.chrome.driver" : "chromedriver.exe", //chromedriver location
    }
  },
  "test_settings": {
    "default": {
      "screenshots": {
        "enabled": true, // if you want to keep screenshots
        "path": SCREENSHOT_PATH // 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, // turn off to test progressive enhancement
        "chromeOptions" :{
        "args":[]
        },
        "selenium": {
            "cli_args": {
              "webdriver.chrome.driver" : "chromedriver.exe",
            },
        },
      },
    }
  }
}

更多示例:https://github.com/dwyl/learn-nightwatch