我有一個簡單的測試來在Chrome中打開launch_url。但我收到錯誤,因爲無法檢索任何新的會話。Nightwatch:從硒服務器檢索新會話時出錯
另外我想知道如何使用夜間沒有在網格中運行。只是一個獨立的實例。
下面是我用過的配置。
{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : false,
"server_path" : "./bin/selenium-server-standalone-3.4.0.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./bin/chromedriver.exe",
"webdriver.gecko.driver" : "",
"webdriver.edge.driver" : ""
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://127.0.0.1",
"selenium_port" : 4444,
"selenium_host" : "127.0.0.1",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "firefox",
"marionette": true
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"edge" : {
"desiredCapabilities": {
"browserName": "MicrosoftEdge"
}
}
}
}
當我使用命令nightwatch --env鉻或者乾脆nightwatch運行nightwatch,它給了我下面的錯誤
[Test1] Test Suite
======================
Running: Demo test
http://127.0.0.1
Error retrieving a new session from the selenium server
Connection refused! Is selenium server started?
{ status: 13,
value:
{ message: 'Error forwarding the new session Empty pool of VM for setup Capabilities [{acceptSslCerts=true, marionette=true, name=Test1, browserName=chrome, javascriptEnabled=true, platform=ANY}]',
class: 'org.openqa.grid.common.exception.GridException' } }
我的測試看起來像
module.exports = {
'Demo test' : function (browser) {
console.log(browser.launchUrl);
browser
.url(browser.launchUrl)
.end();
}
};
我可以請參閱啓動網址已登錄到控制檯,但瀏覽器未啓動。我正在使用最新的jar文件和chromedriver二進制文件。
你嘗試設置「start_process」:false,爲「start_process」:true,? – QualiT