gpt4 book ai didi

node.js - 驱动程序可执行文件的路径必须由 web driver.gecko.driver 系统属性设置;夜间值类

转载 作者:搜寻专家 更新时间:2023-10-31 23:59:53 24 4
gpt4 key购买 nike

我尝试在我的 Windows 8 机器上设置 Nightwatch.js

我安装了 nodejs、nightwatch 和 selenium-standalone-sever 3.0.0-beta1.jar。当我尝试运行我的 sample.js 测试时,出现以下错误。

Error retrieving a new session from the selenium server

Connection refused! Is selenium server started?
{ state: 'unhandled error',
sessionId: null,
hCode: 847580505,
value:
{ localizedMessage: 'The path to the driver executable must be set by the web
driver.gecko.driver system property; for more information, see https://github.co
m/mozilla/geckodriver. The latest version can be downloaded from https://github.
com/mozilla/geckodriver/releases',
cause: null,
suppressed: [],
message: 'The path to the driver executable must be set by the webdriver.ge
cko.driver system property; for more information, see https://github.com/mozilla
/geckodriver. The latest version can be downloaded from https://github.com/mozil
la/geckodriver/releases',
hCode: 294316877,
class: 'java.lang.IllegalStateException',
screen: null },
class: 'org.openqa.selenium.remote.Response',
status: 13 }

我的配置文件是:

{
"src_folders" : ["tests"],
"output_folder" : "reports",
"custom_commands_path" :"",
"custom_assertions_path" :"",
"page_objects_path" :"",
"globals_path":"",
"selenium": {
"start_process" : false,
"server_path" : "",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "",
"webdriver.ie.driver" : ""
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost",
"silent": true,
"screenshots" : {
"enabled" : false,
"path" : ""
},
"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}

我的 sample.js 文件是:

 module.exports = {
'Demo test Google' : function (browser) {
browser
.windowMaximize()
.url('http://www.google.com')
.waitForElementVisible('body', 1000)
.setValue('input[type=text]', 'nightwatch')
.waitForElementVisible('button[name=btnG]', 1000)
.click('button[name=btnG]')
.pause(1000)
.assert.containsText('#main', 'Night Watch')
.end();
}
};

最佳答案

所需的功能应该如下所示,但我不确定 nightwatch js 是否支持 webdriver 3.0

"desiredCapabilities": {
"browserName": "firefox",
"javascriptEnabled": true,
"acceptSslCerts": true,
"marionette": true
}

并且 cli_arguments 应该有 geckodriver 的路径。

"cli_args" : {
"webdriver.gecko.driver": "<path-to-geckodriver>"
}

您可以从这里下载 geckodriver:https://github.com/mozilla/geckodriver/releases

更多详情:https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver

关于node.js - 驱动程序可执行文件的路径必须由 web driver.gecko.driver 系统属性设置;夜间值类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38693682/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com