Forum Discussion

kaizibaby's avatar
kaizibaby
New Contributor
10 years ago

Other way to identify UI elements other than using the logical tree

Hi, 

 

In TestComplete, currently the only way to identify an UI element is using Object Spy and logical tree. By giving the UI elements aliases does make the life easier, but when developers change the UI, the aliases will be broken.

 

So is there another way to identify UI elements, which is not dependant on the Logical Tree. One approach in my mind is, when devs create an UI element, they add an unique attribute which will be dedicated for automation testing. Not sure if it is feasible

 

Please give advices if you have any good approaches

 

Cheers

Kai

2 Replies

  • If your developers have given ids to objects, then you can use those as you say - you don't have to use the default properties chosen by TestComplete to identify the objects.  For example, you might use idStr of a Button object when web testing - this might be more robust to change.  Other approches are not to use NameMapping at all, but use functions such as

    TestObj.Find(PropNamesPropValuesDepthRefresh)