Webdriver-Set Browser launch language

Source: Internet
Author: User

Webdriver-Set Browser launch language

Author: Max.bai

Time: 2015/06


Webdriver-Set Browser launch language

Sometimes opening a browser requires a special language version, for example, English, Chinese.

Test found that the machine is the default startup is the system language corresponding browser, our website is measured in Chinese, and the system is in English, open browser is English, submitted some data in en-US format submitted, resulting in data error, then we need to set the browser launch language.


1. Firefox

Firefox we can solve this problem by Firefoxprofile.

Firefoxprofile FFPF = new Firefoxprofile (); FFPF. Setpreference ("Intl.accept_languages", "EN-GB");//For firefoxdriverdriver = new Firefoxdriver (FFPF);//For remote Driverdesiredcapabilities ffcaps = Desiredcapabilities.firefox (); Ffcaps.setcapability (FirefoxDriver.PROFILE, Ffpf.tostring ());d river = new Remotewebdriver (new URL (Remoteurl), ffcaps);

2. Chrome

Chrome needs to be addressed through Chromeoptions.

At the same time chromeoption can also solve the start of the browser to add the parameters of execution, such as--private.

Chromeoptions op = new Chromeoptions () op.addarguments ("--LANG=ZH-CN");//For chromedriverdriver = new Chromedriver (OP) ;//For remote driverdesiredcapabilities chromecaps = Desiredcapabilities.chrome (); Chromecaps.setcapability (" Chromeoptions ", op);d river = new Remotewebdriver (new URL (Remoteurl), chromecaps);

3. IE

IE is simple, no code to solve, directly manually set the language of IE can be, automated execution is the language you set, of course, you can also modify the registry to automate the problem, which registry to check it yourself






Webdriver-Set Browser launch language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.