How to change chrome browser language in selenium automation

前端 未结 1 1109
情歌与酒
情歌与酒 2021-01-06 10:46

I want to automate localization functions of a web application. According to my application when the browser language changes, application language should change automatical

相关标签:
1条回答
  • 2021-01-06 11:21

    Set the language code in chrome options before launching the the driver as shown below.

    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");
    

    For language codes : https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes

    0 讨论(0)
提交回复
热议问题