0

It looks to me that the chrome webdriver forces the locale to en-us when we use it with selenium remotewebdriver. Can anyone confirm exactly how this works and if its possible to force the use of a particular locale (preferrably without delegating to a proxy server)?

MikePatel
  • 2,593
  • 2
  • 24
  • 38

2 Answers2

0

(This is taken from an answer on the topic: Set Chrome's language using Selenium ChromeDriver.)

You can do it by adding Chrome's command line switch "--lang".

Here's how this might look like in Java:

ChromeOptions options = new ChromeOptions();
options.addArguments("--lang=de-de");
return new ChromeDriver(options);
Community
  • 1
  • 1
Henrik Heimbuerger
  • 9,924
  • 6
  • 56
  • 69
-1

You can configure the browser by using capabilities.

for example:

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("default_locale", "your_locale");
WebDriver driver = new ChromeDriver(capabilities);  //or RemoteWebdriver(capabilities);

I'm not sure that the name of locale capability is "default_locale". Look at the Chrome manual to clarify it.

Pazonec
  • 1,549
  • 1
  • 11
  • 35
  • 1
    Selenium seems to not respect it. – MikePatel Feb 22 '12 at 16:01
  • This sounds good, but I couldn't make it work either. The `default_locale` field is also neither mentioned by [Selenium's page for DesiredCapabilities](https://code.google.com/p/selenium/wiki/DesiredCapabilities) nor by [ChromeDriver's](https://sites.google.com/a/chromium.org/chromedriver/capabilities). – Henrik Heimbuerger May 05 '14 at 13:12