Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在selenium automation中更改chrome浏览器语言_Selenium_Selenium Webdriver_Localization_Selenium Chromedriver - Fatal编程技术网

如何在selenium automation中更改chrome浏览器语言

如何在selenium automation中更改chrome浏览器语言,selenium,selenium-webdriver,localization,selenium-chromedriver,Selenium,Selenium Webdriver,Localization,Selenium Chromedriver,我想自动化web应用程序的本地化功能。根据我的应用程序,当浏览器语言更改时,应用程序语言应根据浏览器语言自动更改。如何做到这一点?在启动驱动程序之前,在chrome选项中设置语言代码,如下所示 System.setProperty("webdriver.chrome.driver","<PATH>/chromedriver.exe"); ChromeOptions chromeoptions = new ChromeOptions(); // for japanese languag

我想自动化web应用程序的本地化功能。根据我的应用程序,当浏览器语言更改时,应用程序语言应根据浏览器语言自动更改。如何做到这一点?

在启动驱动程序之前,在chrome选项中设置语言代码,如下所示

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");
System.setProperty(“webdriver.chrome.driver”,“/chromedriver.exe”);
ChromeOptions ChromeOptions=新的ChromeOptions();
//日语
chromeoptions.addArguments(“-lang=ja”);
ChromeDriver驱动器=新的ChromeDriver(chromeoptions);
驱动程序。获取(“https://www.google.com");
有关语言代码:

请参阅此以了解firefox浏览器的更改