使用Chrome驱动程序,Selenium的Nightwatch.js日志配置

时间:2017-08-23 22:25:46

标签: selenium-chromedriver nightwatch.js

我正在使用Chrome驱动程序和Selenium运行节点nightwatch.js

在nightwatch.json中配置似乎无法正常工作

<div class="imgContainer m-b-10 foroverlay0305"><img alt="company logo" class="" src="<?php echo $blogImage;?>"><span><?php if(isset($category_blog_title)){ echo $category_blog_title;} ?></span></div>
  <h2><?php if(isset($row->title)){ echo character_limiter($row->title, 15);} ?></h2>
  <p style="color:#340000;"><?php if(isset($row->post_date)){ echo $row->post_date;} ?></p>
  </a>
</div>

2 个答案:

答案 0 :(得分:0)

终于搞定了

"silent": true

这很简单

答案 1 :(得分:0)

你可以发布整个配置文件吗?

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

相关问题