我正在尝试在linux盒子(centos OS)上运行nightwatch自动UI测试。我有以下nightwatch.json配置:
{
"src_folders": [
"tests"
],
"output_folder": "reports",
"custom_commands_path": "custom_commands",
"custom_assertions_path": "",
"page_objects_path": "",
"live_output" : true,
"globals_path": "globals.js",
"selenium": {
"start_process": true,
"server_path": "lib/selenium-server-standalone-2.52.0.jar",
"log_path": "",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "lib/chromedriver",
"webdriver.chromeJenkins.driver": "../../tools/chromedriver/chromedriver",
"webdriver.ie.driver": "lib/IEDriverServer_x64_2.52.2.exe",
"trustAllSSLCertificates": true
}
},
"test_workers": {
"enabled": true,
"workers": "auto"
},
"test_settings": {
"default": {
"launch_url": "",
"selenium_port": 4444,
"selenium_host": "localhost",
"silent": true,
"screenshots": {
"enabled": true,
"on_failure": true,
"on_error": true,
"path": "./screenshots"
},
"end_session_on_fail": false,
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": [
"use-fake-device-for-media-stream",
"use-fake-ui-for-media-stream"
]
}
}
},
"jenkins" : {
"selenium_port" : 4444,
"selenium_host" : "127.0.0.1",
"cli_args" : {
"webdriver.chrome.driver" : "lib/chromedriver"
},
"chromeOptions" : {
"args" : ["--no-sandbox"]
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"platform" : "LINUX",
"chromeOptions" : {
"args" : ["--no-sandbox"]
}
}
}
}
我正在使用jenkins环境。
我将chromedriver安装到lib /文件夹 我将selenium-standalone.jar安装到lib /文件夹
但是当我通过做节点nightwatch --test tests / login.js
来运行测试时我收到错误:
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
我做错了什么?