如何使用 Selenium(Java) 更改网页中的语言?
How to change language in web page using Selenium(Java)?
他们是一种为网页预定义语言的方法吗?我想加载西班牙语的 google 页面,我们可以设置 webdriver 的 属性 以加载西班牙语的页面吗?
勾选thislink:
对于 Firefox:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference( "intl.accept_languages", "es" );
WebDriver driver = new FirefoxDriver(profile);
对于Chrome:
ChromeOptions options = new ChromeOptions();
options.AddArguments("--lang=es");
ChromeDriver driver = new ChromeDriver(options);
他们是一种为网页预定义语言的方法吗?我想加载西班牙语的 google 页面,我们可以设置 webdriver 的 属性 以加载西班牙语的页面吗?
勾选thislink:
对于 Firefox:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference( "intl.accept_languages", "es" );
WebDriver driver = new FirefoxDriver(profile);
对于Chrome:
ChromeOptions options = new ChromeOptions();
options.AddArguments("--lang=es");
ChromeDriver driver = new ChromeDriver(options);