首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NightwatchJS从不运行url

NightwatchJS从不运行url
EN

Stack Overflow用户
提问于 2017-01-22 21:55:30
回答 1查看 197关注 0票数 0

我一直在尝试配置nightwatch来执行一些单元测试任务。

Selenium服务器和chrome正在运行,但我从未在chrome的url栏中实际加载url,因此什么也没有出现,我只是在chrome的url (使用chromedirver)中得到一个带有"data;“的空白页面。

这是我的配置,如果有人可以帮助的话

代码语言:javascript
复制
{
  "src_folders" : ["test"],
  "output_folder" : "reports",
  "custom_assertions_path" : "",
  "globals_path" : "",
  "live_output" : true,
  "parallel_process_delay" : 10,
  "disable_colors": false,
  "test_workers" : false,

  "selenium" : {
    "start_process" : true,
    "server_path" : "bin/selenium.jar",
    "host" : "127.0.0.1",
    "port" : 4444,
    "cli_args" : {
      "webdriver.chrome.driver" : "bin/chromedriver",
      "webdriver.firefox.profile" : "bin/geckodriver"
    }
  },

  "test_settings" : {
    "default" : {
      "launch_url" : "test_link.com",
      "selenium_host" : "127.0.0.1",
      "selenium_port" : 4444,
      "silent" : true,
      "disable_colors": false,
      "screenshots" : {
        "enabled" : false,
        "path" : ""
      },
      "desiredCapabilities" : {
        "browserName" : "chrome",
        "javascriptEnabled" : true,
        "acceptSslCerts" : true
      }
    },

    "saucelabs" : {
      "selenium_host" : "ondemand.saucelabs.com",
      "selenium_port" : 80,
      "username" : "${SAUCE_USERNAME}",
      "access_key" : "${SAUCE_ACCESS_KEY}",
      "use_ssl" : false,
      "silent" : true,
      "output" : true,
      "screenshots" : {
        "enabled" : false,
        "on_failure" : true,
        "path" : ""
      },
      "desiredCapabilities": {
        "name" : "test-example",
        "browserName": "firefox"
      },
      "globals" : {
        "myGlobal" : "some_sauce_global"
      },
      "selenium" : {
        "start_process" : false
      }
    },


    "testingbot" : {
      "selenium_host" : "hub.testingbot.com",
      "selenium_port" : 80,
      "apiKey" : "${TB_KEY}",
      "apiSecret" : "${TB_SECRET}",
      "silent" : true,
      "output" : true,
      "screenshots" : {
        "enabled" : false,
        "on_failure" : true,
        "path" : ""
      },
      "desiredCapabilities": {
        "name" : "test-example",
        "browserName": "firefox"
      },
      "selenium" : {
        "start_process" : false
      }
    }
  }
}

这是我的测试

代码语言:javascript
复制
module.exports = {
  'Tracking the website': function (client) 

    client
      .url(client.launch_url)
      .getValue('#id1', function(result){
        console.log("================================");
        console.log("value " + result.value);
        console.log("================================");
      })
      .end();
  }
};
EN

回答 1

Stack Overflow用户

发布于 2017-01-23 03:55:51

这是因为您的launch_url不包含要使用的协议。

尝试使用"launch_url" : "http://www.google.com"而不是"launch_url" : "www.google.com"

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41791738

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档