我使用Nightwatch.js在我們的Web應用程序上構建/運行端到端測試,並且作爲構建過程的一部分,我們希望將其與Jenkins集成。在我的本地機器上,我可以同時在所有三種瀏覽器(Firefox,Safari,Chrome)上運行測試,沒有任何問題。我也可以在沒有問題的個人瀏覽器上運行。我有正確和最新版本的硒驅動程序,並指向他們在我的nightwatch.json文件。但是,由於某種原因,我無法在運行這些測試的專用機器上啓動Safari,而當新的Jenkins版本進入時,所有設置都與機器上的設置完全相同,但我以不斷收到錯誤無法使用Nightwatch啓動Safari瀏覽器
Error retrieving a new session from the selenium server
Failed to connect to SafariDriver after 10066ms
發生這種情況時,Chrome和Firefox都可以正常加載,但只有Safari有問題。我們確保爲Safari下載最新版本的獨立硒驅動程序,並且我再次做到了這一點。我也做了一定要檢查是否有恰好是硒服務器運行的另一個實例,但它從來沒有
我nightwatch.json文件看起來像這樣的情況下....
{
"src_folders" : ["test"],
"output_folder" : "reports",
"custom_commands_path" : "node_modules/nightwatch-custom-commands- assertions/js/commands",
"custom_assertions_path" : "node_modules/nightwatch-custom-commands-assertions/js/assertions",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : true,
"server_path" : "lib/selenium-server-standalone-2.53.0.jar",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "lib/chromedriver",
"webdriver.safari.driver" : "lib/selenium-server-standalone-2.53.0.jar"
}
},
"test_settings" : {
"firefox" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : "./screenshots"
},
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true
},
"end_session_on_fail": false,
"skip_testcase_on_fail": false
},
"chrome" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : "./screenshots"
},
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
},
"end_session_on_fail": false,
"skip_testcase_on_fail": false
},
"safari" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : "./screenshots"
},
"desiredCapabilities" : {
"browserName" : "safari",
"javascriptEnabled" : true,
"acceptSslCerts" : true
},
"end_session_on_fail": false,
"skip_testcase_on_fail": false
}
}
}
如果任何人有任何洞察,爲什麼這可能會發生我會很感激。由於
請在您的答案中給予_更多詳細信息或鏈接到詳細信息。 – nelsonic
的確如此。我遇到了同樣的問題。我有Safari並且安裝了webdriver。儘管如此,仍然有錯誤 –