initClient Nightwatch - TypeError: Cannot read property 'verbose' of null

别说谁变了你拦得住时间么 提交于 2021-01-29 14:51:05

问题


I'm seeing the same error with below code. Is this a actual bug in initClient()? Any help is appreciated, thanks!

async 'mydemo'(browser){

        var nightwatch = require('../node_modules/nightwatch');
        var config = require('../nightwatch.json');

        console.log(config);
        var client = nightwatch.initClient(config.test_settings.default);
        var browserObj = client.api();

        const homePage = browserObj.page.homepage();
        homePage.navigate();
        let result = await homePage.api.elements('css selector', 'div.flex.mt-4.v-card.v-sheet.theme--light > div > div > table > tbody > tr');
        console.log(" NightWatch Obj Row Length is " + "<->" + result.value.length);

    }

Nightwatch.json

{
  src_folders: [ 'Tests' ],
  page_objects_path: [ 'pageobjects' ],
  webdriver: {
    start_process: true,
    server_path: 'node_modules/chromedriver/lib/chromedriver/chromedriver',
    port: 9515
  },
  test_settings: {
    default: {
      launch_url: 'http://localhost:8080',
      desiredCapabilities: [Object]
    }
  }
}

Error: FAILED: 1 errors (17ms) TypeError: Cannot read property 'verbose' of null

Please let me know how to create browser object programatically from a nightwatch.json file, thanks!

来源:https://stackoverflow.com/questions/60471945/initclient-nightwatch-typeerror-cannot-read-property-verbose-of-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!