Localization Testing using Selenium Webdriver is necessary when working with international web applications. We need to test those web apps in many different languages. Our test automation codes have to be run in each local chapter of the application or website. You can also think this as globalization testing as well. They are well described on here.
Localization Testing Real Life Scenario
Real Life Scenario: Sometimes, websites have an option to change its language independent from the browser’s language. Some of them change the web app’s language according to the browser’s local settings.
Question: So how to change your browser’s language for multi-language tests in Selenium Webdriver?
Solution: All you need to do is to provide the necessary ChromeOptions or FirefoxOptions objects into your drivers.
Chrome Driver Options
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
ChromeOptions options = new ChromeOptions();
driver = new ChromeDriver(options);
Firefox Driver Options
FirefoxOptions options = new FirefoxOptions();
driver = new FirefoxDriver(options);
Language parameter can be:
Happy multi-language testing in Selenium Webdriver projects. Now, you can do localization testing using Selenium Webdriver without any pain. 🙂