Approach for Automating localized Web application in Selenium using Java Bindings Approach for Automating localized Web application in Selenium using Java Bindings selenium selenium

Approach for Automating localized Web application in Selenium using Java Bindings


You're right that there is a problem managing the files, but you're also right that this is the best approach. Some things are just hard :-(

Selenium (at least the Selenium RC API) does indeed support Unicode input and output, we have lots of tests that enter and confirm Cyrillic and Simple Chinese characters from C#. Since Java strings are Unicode at the core (just like C#), I expect you could simply create the file in a UTF-8-friendly editor like Notepad++ and read them straight into strings and use them directly in the Selenium API.


This is how I solved the issue for those who are interested.


a database would work better for many reasons, like growth, central location, kept outside of app and can be edited and maintained outside of app. We used a table with columns:

id (int) auto incrementid_text -- this and other columns are varchar ... except for date time for last 2langtranslationcreated_byupdated_bycreated_dateupdated_date

An id is a short english description of the text - like 'hello' or 'error1msg', the key in your map.

In java had a function to get the text for a particular text ... and a app level property - default language (usually en but good to keep it configurable)

Function would scan already loaded hashmap for language asked for - say "ch"

If corresponding translation was not found for this language we would return the default language translation and if that was not founf then we would return "[" + id "]" so the tester knows something is missing in data base - can go to web screen to edit translation table and add it.