简体   繁体   中英

How to configure webpage language using selenium webdriver

I wanna set the web page language to international languages (eg: es ie spanish) , I tried below code :

System.setProperty("webdriver.chrome.driver", "E://chromedriver.exe");
ChromeOptions options=new ChromeOptions();
options.addArguments("--lang=es");
ChromeDriver driver=new ChromeDriver(options);
driver.manage().window().maximize();
//driver.get("http://www.google.com");
driver.get("http://www.yahoo.com");
driver.close();

The above code is successfully translating only google. Coming to other websites like yahoo, the page is remained in english and the chrome browser is translated in spanish. I want to translate entire webpage as well. Can anyone help me out please.

Thanks.

Try this. Maybe it would clear up things: How to change language on desired browser .

Another useful tool is i18n-checker (to check is your language supported).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM