Posted: 18 Mar 2015 14:10 EDT Last activity: 23 Mar 2015 8:26 EDT
Pega generated HTML does not work well with selectors in automation
I have noticed that most of the UI elements that appear on our application pages do not have IDs, or have duplicate IDs, forcing me to construct relative-path queries in XPath or CSS to get to the control or text element in Selenium WebDriver. The problem with relative-path queries is that they are inherently unstable, and not even guaranteed to work. If anything changes on the page, it can disrupt code access to every element referenced using that method. In fact, there are some elements that are simply impossible to access.
Is there a way to modify the generated HTML so that it better supports test automation with IDs for the items we care about interacting with? Obviously, I don't want IDs on every HTML item, and I wouldn't want random IDs that change with every build.
The point is, Pega's lack of support for test automation best practices in HTML, such as IDs, is breaking my automation and creating a lot of false negative results.
This does sound like an excellent feature request. As a possible work around that might make it a little easier and less brittle: You can add a css class to most controlls on in your layouts, my test shows no ill affects if you add a non existent class, you could then use the class references in the dom search. I admit it is not the most elegant solution but it may be of some use.
We have (starting in 7.1.7) added a Test Id feature to the product, added primarily to uspport automated testing. Test Id is supported on lot of different components, and is available on the Property panel. Please take a look at Product help, and Whats new in 7.1.7