Rxpath issues with custom tag names

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
mrt
Posts: 259
Joined: Mon Mar 16, 2020 11:31 am

Rxpath issues with custom tag names

Post by mrt » Tue Sep 07, 2021 12:19 pm

Dear folks,

I have an issue since day 1 using Ranorex and it becomes more and more painful:

If I use tagnames in the Rxpath that are - let's say "standard HTML" - like body or label, object recognition works fine.

Code: Select all

/body/label/...
But if I try to use "custom" tagnames which were defined by developers (and are almost everywhere), this does not work.
I have to add tag and tagname attribute, like this:

Code: Select all

tag[@tagname='mytag1']/tag[@tagname='mytag2']/...
As you see, this easily doubles the characters for each element and is much more complicated.
Not only creating those repository items take longer and longer, because of the long RXpath it is also very hard to maintain them.

Is there any possibility to get around this, maybe by adding some list of tagnames somewhere so that they are recognized as easily as standard HTML tags?

Help would be greatly appreciated, thanks!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Rxpath issues with custom tag names

Post by odklizec » Tue Sep 07, 2021 12:50 pm

Hi,

I'm afraid, there is no any workaround for this. However, are you sure you must add all these elements to the xpahts? In most cases, it should be enough to use only few elements with good identification attributes. Also a very good practice is to use rooted folders, containing the general xpath common for multiple elements. Eventually, use other elements as "anchors" and traverse to the element you want using xpath axes (parent, ancestor, descendant, etc...).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

mrt
Posts: 259
Joined: Mon Mar 16, 2020 11:31 am

Re: Rxpath issues with custom tag names

Post by mrt » Tue Sep 07, 2021 1:02 pm

Hi,

ok, sad to hear.
Basically the whole hierarchy of the page consists of one custom tag after another, so I am afraid there is no way getting "around them".

Yes, I already have several rooted folders in place to get things organized, otherwise the pain would be even higher.

Thanks!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Rxpath issues with custom tag names

Post by odklizec » Tue Sep 07, 2021 1:09 pm

Rooted folders not only make the things better organized, but they also make the search for elements faster! Well, good luck with custom elements. I understand your pain, but I personally don't care about custom tags or "standard" HTML tags as long as there are unique and persistent attributes ;) In many cases, I'm forced to use classes, which are often full of texts. But they are also pain to use because one needs to use regexes to pick only the useful details and eliminate all redundant strings. And this makes the xpaths even more complicated ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration