问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/50442811/is-it-possible-change-browser-language-in-firefox-using-selenium