Member-only story
Keep the Selenium Code Independent of the Site Language
(Selenium for Beginners)
An automated test should not only work correctly.
It should also
- be short
- be easy to understand
- be easy to maintain
- have no code duplication
- be browser independent
- be language independent
- be environment independent
This is one of the reasons why test automation is not easy to do. It is not sufficient to just write code that interacts with the site using the Selenium library. The code has to have many other qualities in addition to doing what is supposed to be doing.
I am interested in exploring in this short article 2 of the qualities of a good automation test:
- no code duplication
- language independent
We can use a site that is available in more than one language for our case.
It is not uncommon to find in the automation project for a multi-language site lots of code that is used to interact with the site elements when the language is English and also duplicated code for the same actions in French or Spanish.