Question about simplified RanoreXPath - Disadvantages?

Ask general questions here.
BlindJones
Posts: 51
Joined: Fri May 17, 2019 7:10 am

Question about simplified RanoreXPath - Disadvantages?

Post by BlindJones » Fri Oct 16, 2020 5:55 am

Good morning,

I have to test a new web application with Ranorex and I am lucky to be involved in the coding from the beginning.

I asked one of the developers to implement unique IDs at all GUI Elements which I can use for tracking them easily in Ranorex.

Since all IDs are absolutey unique: Can I keep my Repository pathes in that solution as simple as possible?

For example: [DOM:xyz.com]\\button[@ID=uniqueID1]

Ranorex Spy do find the element in that case.

My question now is whether I will have to deal with some disadavantages when building up the repository like that?
Maybe the time of execution will increase much? It seems we will have around 500 test cases / recordings in that solution in the end...
Does it make sense to specifiy the path more even the ID is unique?

Thank you for sharing your thoughts!

Kind regards
Sebastian

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

Re: Question about simplified RanoreXPath - Disadvantages?

Post by odklizec » Fri Oct 16, 2020 6:42 am

Hi,

Well, the search for elements, with such short xpath, could be a bit slower. But it usually depends on how complex the UI under test is. I personally prefer a bit more complex, yet faster xpaths. BTW, to make your xpaths faster, you can use this "unique ID" syntax instead...
[DOM:xyz.com]\\button[#'uniqueID1']
This syntax makes the search for elements much faster, in comparison with "@id" syntax. The downside of this xpath is, that it cannot be directly combined with other parameters and functions.

This is not possible:

Code: Select all

[DOM:xyz.com]\\button[#'uniqueID1' and @visible='true']
However, this will do the job nicely:

Code: Select all

[DOM:xyz.com]\\button[#'uniqueID1'][@visible='true']
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

BlindJones
Posts: 51
Joined: Fri May 17, 2019 7:10 am

Re: Question about simplified RanoreXPath - Disadvantages?

Post by BlindJones » Fri Oct 16, 2020 8:08 am

Hi Pavel,

wow, that sounds very interesting.

The guy from the development told me that he can not set "Unique ID" as an attribute in html (because of the empty space), would "UniqueID" do the trick then?

Kind regards
Sebastian

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

Re: Question about simplified RanoreXPath - Disadvantages?

Post by odklizec » Fri Oct 16, 2020 8:10 am

Hi,

Sure, unique ID string without space is preferred anyway. I personally hate names/ids with spaces :D
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

User avatar
Stub
Posts: 443
Joined: Fri Jul 15, 2016 1:35 pm

Re: Question about simplified RanoreXPath - Disadvantages?

Post by Stub » Fri Oct 16, 2020 9:57 am

Like Pavel, I too prefer the more specific/complex RxPaths as far as possible - I strive to avoid using // if I can, though I keep it in the locker when it comes in handy. I also use ID in preference - where I can, since our Dev team do not use it at all consistently, unfortunately. I only recently learned about the # shortcut, but didn't know it had performance improvements. I use it by preference anyway, reverting to @id when I need to add additional factoids to the path, as Pavel recommends.

And I very, very much agree with Pavel about names/IDs with spaces! I've been teaching others in our QA team how to Ranorex lately, and have been pummelling that lesson into them :D