I want to automate localization functions of a web application. According to my application when the browser language changes, application language should change automatically according to the browser language. How to do that?
Asked
Active
Viewed 5,090 times
1 Answers
6
Set the language code in chrome options before launching the the driver as shown below.
System.setProperty("webdriver.chrome.driver","<PATH>/chromedriver.exe");
ChromeOptions chromeoptions = new ChromeOptions();
// for japanese language
chromeoptions.addArguments("–lang= ja");
ChromeDriver driver = new ChromeDriver(chromeoptions);
driver.get("https://www.google.com");
For language codes : https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

Torbilicious
- 467
- 1
- 4
- 17

Vijendran Selvarajah
- 1,330
- 1
- 11
- 31
-
4Please refer this https://stackoverflow.com/questions/50442811/is-it-possible-change-browser-language-in-firefox-using-selenium/50442825#50442825 for firefox browser change – Vijendran Selvarajah May 22 '18 at 10:39