Page 1 of 1

Tracking same element get another repo item

Posted: Thu Mar 05, 2020 4:49 pm
by henrikw
Ranorex 9.3

Hi,

So, I have started creating an object repository for a web app. It consist of forms where I had to manually edit the rxpath in order to uniquely identify them based on their labels. Everything good and it worked.

However when I track the same elements again I get a new repository items. It will not highlight the ones I have already uniquely identified by manually editing them.

Any ideas why it behaves like this?

Re: Tracking same element get another repo item

Posted: Fri Mar 06, 2020 8:34 am
by Stub
Something in your RxPath will have changed. An index, a wildcard, some variable runtime attribute, etc. I would examine the RxPaths that you used previously and the new paths to the element you're after, and eliminate whatever is causing the variability.

Re: Tracking same element get another repo item

Posted: Fri Mar 06, 2020 8:37 am
by odklizec
Hi,

Once you change the xpath of a repo element, it's not the same element anymore ;) Therefore, Ranorex uses actual xpath weight, to create a new repo element.

Ranorex adds elements to repository, based of the xpath weight, where each element has its weight value. Higher weight value means higher priority in xpath construction process. For example, attribute ID has highest priority, then InnerText, TagValue, etc.... If you wish that Ranorex for example prioritizes Class attribute over ID (good in case of Android or Angular), you need to set the weight value of Class attribute higher than ID attribute.

For more details about setting xpath weights see this article...
https://www.ranorex.com/help/latest/ran ... e-weights/

Re: Tracking same element get another repo item

Posted: Thu Mar 19, 2020 11:42 am
by henrikw
I made the developers adding unique ID's to our web app for buttons, forms, drop lists, checkboxes, radio buttons, error messages etc.

Now when I track i get that ID which is convenient. But it becomes almost too robust I fear but I'm not sure. Doesn't matter if i adjust the slider in Settings>Advanced, it will still create the same path.

But maybe this is good? :)

ex.

Code: Select all

/dom[@domain='172.xx.xx.xx:3002']//button[#'hcpLoginLogin']

Re: Tracking same element get another repo item

Posted: Thu Mar 19, 2020 2:27 pm
by Stub
I've not fiddled with that slider myself, but you might be able to adjust the Ranorex Xpath weight rules to guide how it identifies elements. I've only recently started having a play with this area myself. While I was looking at it in a different context, I was able to largely control and guide the generated RxPaths for our application.