How to set the browser language using selenium webdriver (Internationalization)

Internationalization is a process of designing a software application so that it can be adapted to various languages and regions without any changes

Localization is a process of adapting internationalized software for a specific region or language by adding local specific components and translating text.

If we want to check whether our application is properly internationalized , then we will manually change the language preferences in the browser itself.But if we want to check the same using WebDriver then we have to change the user language preferences.

Using Firefox Browser :

FirefoxProfile profile = new FirefoxProfile();
//setting the locale french : ‘fr’
driver = new FirefoxDriver(profile);
Using Chrome Browser :

ChromeOptions options = new ChromeOptions();
options.addArguments(“–lang= sl”);
ChromeDriver driver = new ChromeDriver(options);

Unfortunately it wont work for IE browser, We need to change it manually.

5 thoughts on “How to set the browser language using selenium webdriver (Internationalization)

  1. Arun July 26, 2015 / 1:46 pm

    Thanks for the information dude, It helped me a lot.


  2. Shabe Noor August 4, 2015 / 10:39 am

    Great work .realy great job.
    Keep it up.

    Liked by 1 person

  3. NISHANT March 16, 2016 / 10:08 pm

    Is there any workaround for Internet Explorer too ? I know that you have mentioned that it is not possible but if you could help I would appreciate.


  4. Jahnvi Dholakia August 28, 2017 / 9:56 pm

    Hi Charan,

    Seems like above code not working for me. Script runs successfully, but language doesn’t seem to change.

    Also, I tried manually changing browser language and then running script which had just getting Test URL. But, again during runtime browser defaulted to English.

    Any help is appreciated!


    • Hari Charan August 29, 2017 / 9:24 pm

      which browser are you using? If its firefox, could you check this
      1. goto “about:config” page
      2. search for “intl.accept_languages”
      3. modify value to “fr”
      4. browse “” and verify the locale


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s