How to run chrome with german language


I want to run Chrome browser in german language (i.e de-DE). is there any setting need to be added to run in this language. please help me


Hi @lohitN,

I guess your speaking of how to set the preferred language and or list of languages to select for the navigator object window.navigator.language || window.navigator.languages.

To do so you need to pass additional desired caps, namely experimental options to the chrome driver. Open up the endpoint configuration of your Chrome browser, and at the bottom in the textbox for the desired capabilities add this:

  "chromeOptions": {
    "prefs": {
      "intl.accept_languages": "de-DE,de"

as you can see the intl.accept_languages property of the prefs defines the to be used languages array of the DOM where the first one gets selected as the active language.

To verify that it works I’ve created this simple test which requests the language/languages via javascript from the DOM and validates them according to your settings.

// Ranorex Webtestit Test File

package uitest.tests;

import uitest.TestNgTestBase;
import uitest.pageobjects.*;

import org.openqa.selenium.JavascriptExecutor; // <--- NOTE THIS IMPORT
import org.openqa.selenium.WebDriver;
import org.testng.Assert;
import org.testng.annotations.Test;

class newtestfile extends TestNgTestBase {
    public void SampleTestCase() {
        WebDriver driver = getDriver();
        JavascriptExecutor js = (JavascriptExecutor) driver;
        String language = js.executeScript("return window.navigator.language").toString();
        String languages = js.executeScript("return window.navigator.languages").toString();

        Assert.assertEquals(language, "de-DE");
        Assert.assertEquals(languages, "[de-DE, de]");

If you’re testing multiple languages, just add more endpoints with individual language settings.

Updated the sample with the msdn site, which actually forwards you to the respective de/en site based on the navigator language