《星球大战》和《人体掠夺者》:在LinuxBox上运行夜视测试
我正在尝试在linux机箱(centos)上运行nightwatch自动UI测试。我有以下nightwatch.json配置:《星球大战》和《人体掠夺者》:在LinuxBox上运行夜视测试,linux,selenium,nightwatch.js,Linux,Selenium,Nightwatch.js,我正在尝试在linux机箱(centos)上运行nightwatch自动UI测试。我有以下nightwatch.json配置: { "src_folders": [ "tests" ], "output_folder": "reports", "custom_commands_path": "custom_commands", "custom_assertions_path": "", "page_objects_path": ""
{
"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"]
}
}
}
}
我正在使用詹金斯环境
我已将chromedriver安装到lib/文件夹
我将selenium-standalone.jar安装到lib/文件夹
但是当我通过node nightwatch运行测试时——test tests/login.js
我得到一个错误:
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
我做错了什么?很可能是您的服务器路径。我在安装Nightwatch之前遇到过这个问题,最后搜索node_模块中的子目录以找到selenium服务器独立jar。有时我甚至不得不单独安装它。目前我把它命名为“服务器路径”:“/node\u modules/testarmada magellan nightwatch/node\u modules/selenium server/lib/runner/selenium-server-standalone-2.52.0.jar”,尽管你很可能在别处找到它。它很可能是你的服务器路径。我在安装Nightwatch之前遇到过这个问题,最后搜索node_模块中的子目录以找到selenium服务器独立jar。有时我甚至不得不单独安装它。目前我将其命名为“服务器路径”:“/node_modules/testarmada magellan nightwatch/node_modules/selenium server/lib/runner/selenium-server-standalone-2.52.0.jar”,尽管您很可能在其他地方找到它。