Company
Date Published
Author
Adam Goucher
Word count
915
Language
English
Hacker News points
None

Summary

To minimize the pain of locator breakage in Selenium, it is recommended to separate scripts from locators and use an external mechanism to provide the locators. This can be achieved through user-extensions in Selenium IDE or by reading run-time properties from external files in languages such as Java. Using a consistent naming convention for property names can increase readability and make it easier to cascade changes throughout the suite of scripts. Page Objects are also beneficial, but that is beyond the scope of this article. The goal is to avoid hardcoding locator strings and instead use an abstraction mechanism to allow for easy updates without recompilation. By doing so, teams can reduce the time invested in maintaining their automation and keep pace with feature development.