Set Firefox Settings in Nightwatch

How do you set firefox preferences in a nightwatch? I would like to make an equivalent in java with nightwatch.

FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("intl.accept_languages", "de"); WebDriver driver = new FirefoxDriver(profile); 

It works for me 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

+8
javascript firefox selenium selenium-webdriver
source share
1 answer

The solution is to create a Firefox profile for your Nightwatch test.

1) Create a new Firefox profile:

In the terminal, run the following command: firefox -p "
Then create a profile called " webdriver ".

2) Set up a new profile

Go to this configuration page with the URL: about: config
Find 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! this is not the "desired method" parameter.

Solution 1: (test configuration)

 { "yourTest" : { "default" : { ... "webdriver.firefox.profile" : "webdriver", "launch_url": "http://localhost:3000", "desiredCapabilities" : { "browserName" : "firefox", "javascriptEnabled" : true, "acceptSslCerts" : true } } } } 

Solution 2: (global configuration)

 { ... "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 selenium settings: http://nightwatchjs.org/guide#selenium-settings

+5
source share

All Articles