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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742297052a4417337.html
评论列表(0条)