Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

1 like 0 dislike
867 views
by The go-to Tester (324 points)
edited by

How to handle internationalisation through web driver?

Describe with code.

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
Usually most web applications will use the CMS. They implement the language on the front. So all element identification methods should be the same. E.g. Username and password fields will contain the same name as "uname" and "pwd" for all languages, but lables will change. So implementing this will be very simple.
 
You will be doing language filtering while asserting texts on the front. E.g. Error message, menu items, etc.
 
Usually when you are implementing internationalization, your URL will change and it will pretty much talk about your front.
 
eg. You have a different domain for each language
 
 
 
eg. You will have a different directory for each language
 
 
In above case only texts you see in front will change, HTML elements will be the same.
 
To differentiate between languages, you can create enum and keep it static throughout your test execution.
 
E.g.
 
public enum Language{RU,EN,GU,SA,DE};
 
Now pass the BaseURL (Application to be tested URL) via environment URL, if you are using Ant with JUnit or via TestNG.xml if you are using TestNG.
 
While asserting the message you can check language using your BaseURL/Application URL and assert proper message.
 
Note:
 
While implementing the internationalization, try to avoid element identification using partialLinkedText or linkedText. Try to use xPath or CSS Selector instead.
 
 
 
Hope that helps.


This site is for software testing professionals, where you can ask all your questions and get answers from 1300+ masters of the profession. Click here to submit yours now!

...