我一直在尝试配置nightwatch来执行一些单元测试任务。
Selenium服务器和chrome正在运行,但我从未在chrome的url栏中实际加载url,因此什么也没有出现,我只是在chrome的url (使用chromedirver)中得到一个带有"data;“的空白页面。
这是我的配置,如果有人可以帮助的话
{
"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
}
}
}
}这是我的测试
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();
}
};发布于 2017-01-23 03:55:51
这是因为您的launch_url不包含要使用的协议。
尝试使用"launch_url" : "http://www.google.com"而不是"launch_url" : "www.google.com"。
https://stackoverflow.com/questions/41791738
复制相似问题