我的 nightwatch.json 文件中有以下配置
"saucelabsChrome": {
"selenium_host": "ondemand.saucelabs.com",
"selenium_port": 80,
"username": "example",
"access_key": "--REDACTED---",
"desiredCapabilities": {
"acceptsSslCerts": true,
"name": "chrome",
"browserName": "chrome",
"platform": "OS X 10.11",
"version": "45.0"
}
},
但是,当我使用酱汁实验室运行 nightwatch 时
node nightwatch ---args '{"beta": "true", "env": "stage"}' --test tests/example.js -e saucelabsChrome
我收到一个错误
Couldn't find element signUpAdobe
两个问题
最佳答案
这是我的 nightwatch.json 文件配置为在 Sauce Labs 上运行并行测试的示例。
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "custom_commands",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : false,
"server_path" : "",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "",
"webdriver.ie.driver" : ""
}
},
"test_workers" : {"enabled" : true, "workers" : "auto"},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 80,
"selenium_host" : "ondemand.saucelabs.com",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"username" : "${SAUCE_USERNAME}",
"access_key" : "${SAUCE_ACCESS_KEY}",
"desiredCapabilities": {
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chrome": {
"desiredCapabilities": {
"platform": "XP",
"browserName": "chrome",
"version": "41"
}
},
"firefox" : {
"desiredCapabilities": {
"platform": "XP",
"browserName": "firefox",
"version": "33"
}
},
"internet_explorer_10" : {
"desiredCapabilities": {
"platform": "Windows 7",
"browserName": "internet explorer",
"version": "10"
}
}
}
}
如果您想看一看,这里是整个项目的链接:
https://github.com/saucelabs-sample-test-frameworks/JS-Nightwatch.js
至于你的第二个问题。您可以在 Sauce Labs 仪表板中看到正在运行的测试。登录 www.saucelabs.com 并单击左上角的测试选项卡。
关于nightwatch.js - 如何使用带夜视仪的酱汁实验室?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36137270/