是否可以使用 selenium 在 firefox 中更改浏览器语言?

Is it possible change browser language in firefox using selenium?

我想在 selenium 自动化中以给定的语言启动 firefox 浏览器。我可以这样做吗?如果是这样,请分享一些示例代码实现。

提前致谢。

在启动驱动程序之前,在 fire fox 配置首选项中设置语言代码,如下所示。

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

对于语言代码:https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes