pravin p
pravin p

Reputation: 75

Is it possible change browser language in firefox using selenium?

I want to launch firefox browser in a given language in selenium automation. Can I do that? If so, please share some sample code implementation.

Thanks in advance.

Upvotes: 4

Views: 2002

Answers (1)

Vijendran Selvarajah
Vijendran Selvarajah

Reputation: 1350

Set the language code in fire fox profile preference before launch the the driver as shown below.

FirefoxProfile ffprofile = new FirefoxProfile();
//For japenese language
ffprofile.setPreference("intl.accept_languages","ja");
driver = new FirefoxDriver(ffprofile);
driver.get("https://www.google.com");

For language codes : https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

Upvotes: 7

Related Questions