admin管理员组文章数量:1332383
How do you set firefox preferences in nightwatch? I would like to do the equivalent in java with nightwatch.
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("intl.accept_languages", "de");
WebDriver driver = new FirefoxDriver(profile);
I have this working in chrome, but again I can't figure out how to do it in Firefox.
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions" :{
"prefs": {
"intl.accept_languages":"fr"
}
}
}
Thanks
How do you set firefox preferences in nightwatch? I would like to do the equivalent in java with nightwatch.
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("intl.accept_languages", "de");
WebDriver driver = new FirefoxDriver(profile);
I have this working in chrome, but again I can't figure out how to do it in Firefox.
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions" :{
"prefs": {
"intl.accept_languages":"fr"
}
}
}
Thanks
Share Improve this question asked Oct 3, 2015 at 4:45 Madison HaynieMadison Haynie 4884 silver badges13 bronze badges1 Answer
Reset to default 5The solution is to create a Firefox profile for your Nightwatch test.
1) Create a new Firefox profile:
In a terminal, execute this mand : "firefox -p"
Then create a profil with the name "webdriver".
2) Configure the new profile
Go to this config page with the url : about:config
Search the name "intl.accept_languages" and update the value.
Exit Firefox for now.
3) Configure Nightwatch to use the new profile
"webdriver.firefox.profile" : "webdriver"
List item "browserName" : "firefox"
Be careful ! it is not a "desiredCapability" parameter.
Solution 1: (test config)
{
"yourTest" : {
"default" : {
...
"webdriver.firefox.profile" : "webdriver",
"launch_url": "http://localhost:3000",
"desiredCapabilities" : {
"browserName" : "firefox",
"javascriptEnabled" : true,
"acceptSslCerts" : true
}
}
}
}
Solution 2: (global config)
{
...
"selenium" : {
"start_process" : false,
"server_path" : "",
"log_path" : "",
"host" : "127.0.0.1",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "",
"webdriver.ie.driver" : "",
"webdriver.firefox.profile" : "webdriver"
}
},
...
"yourTest": {
"default": {
"launch_url": "http://localhost:3000",
"desiredCapabilities" : {
"browserName" : "firefox",
"javascriptEnabled" : true,
"acceptSslCerts" : true
}
},
...
}
...
}
check the selenium settings : http://nightwatchjs/guide#selenium-settings
本文标签: javascriptSet Firefox Preferences in NightwatchStack Overflow
版权声明:本文标题:javascript - Set Firefox Preferences in Nightwatch - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742297052a2448944.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论