5

I would like to change browser language. but it is not working. default browser language is displayed..

capabilities: [{
    browserName: 'chrome',
    chromeOptions: {
        args: ['--lang=ja']
    }
}],
Tomo
  • 51
  • 3

2 Answers2

5

If anyone is still interested in making this work, the WebdriverIO implementation would be:

capabilities: [{
    browserName: 'chrome',
    'goog:chromeOptions': {
        args: [ '--your-args-go-here',
                '--like-so',
                '--and-so-and-so' 
                // e.g: '--headless', '--disable-gpu', '--start-fullscreen' 
        ],
        prefs: {
            'intl.accept_languages': 'ru,RU'
        }
    }
}]
  • For the full list of Chromium switches (args array values), click here.
  • For the full list of Chromium preferences (prefs object properties), click here.

Note: another useful resource (which is always up to date) for Chromium switches is Peter Beverloo's Chromium CLI Switches portal.

Using the above Chrome config in the wdio.conf.js & running an Instagram login test will successfully convert the locale of the page to Russian, as seen below:

enter image description here

gimpf
  • 4,396
  • 26
  • 37
iamdanchiv
  • 3,828
  • 4
  • 32
  • 40
  • I know it's an old post, but have you tested setting `prefs: { 'intl.accept_languages': 'ru,RU' }` AND running in headless? It seems to ignore the prefs in that case – Bizmarck Oct 30 '19 at 18:41
1

could you try this instead?

options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
driver = webdriver.Chrome(chrome_options=options)

check on webdriver io how to use add_experimental_option