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
The solution is to create a Firefox profile for your Nightwatch test.
In a terminal, execute this command : "firefox -p"
Then create a profil with the name "webdriver".
Go to this config page with the url : about:config
Search the name "intl.accept_languages" and update the value.
Exit Firefox for now.
"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.org/guide#selenium-settings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With