我试图在linux机器上的chrome浏览器中运行nightwatch.js。 我的夜班测试使用Windows版Chrome驱动程序在Windows机器上运行完美。
我更新了nightwatch.json文件并给了chromedriver的linux版本的路径,但是我的测试没有运行并且给出错误
npm run test-e2e --test tests / regression / testcase1.js
************命令行参数:*********************
启动selenium服务器...已启动 - PID:12625
正在运行:登录UI
从selenium服务器检索新会话时出错
将日志文件写入以下内容时出错:/home/abc/testing/AutomationFramework/logs/selenium-debug.log
连接被拒绝了! selenium服务器是否已启动? {值: {message:'无法创建新服务:ChromeDriverService \ nBuild信息:版本:\'3.12.0 \',版本:\'7c6e0b3 \',时间:\'2018-05-08T15:15:08.936Z \'\ nSystem info:host:\'virtualserver01 \',ip:\'127.0.1.1 \',os.name:\'Linux \',os.arch:\'amd64 \',os.version:\'4.4.0 -124-generic \',java.version:\'1.8.0_171 \'\ n驱动程序信息:driver.version:unknown', 错误:'会话未创建'}, 状态:33}
我的linux机器上也安装了Google Chrome $ google-chrome --version
Google Chrome 65.0.3325.181
我的nightwatch.json文件如下
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"globals_path" : "nightwatch.global.js",
"custom_commands_path": "./commands",
"selenium" : {
"start_process" : true,
"server_path" : "./bin/selenium-server-standalone-3.12.0.jar",
"log_path" : "./logs",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./bin/chromedriver"
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"use_xpath": true,
"selenium_port" : 4444,
"selenium_host" : "localhost",
"screenshots" :{
"enabled" : true,
"path" : "./screenshots",
"on_failure" : true
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": ["disable-web-security"],
"prefs": {
}
}
}
}
}
}