Test Run is not detecting a recorded path

Ranorex Spy, Recorder, and Studio.
kdreiling
Posts: 26
Joined: Mon Sep 24, 2012 9:45 pm
Location: Kansas City

Test Run is not detecting a recorded path

Post by kdreiling » Wed Jan 13, 2021 9:15 pm

Greetings:

I am trying to record a link to an external resource. Ranorex records the click event successfully, but when I attempt to run the recording, I have found that the test has actually recorded both lines (meaning one word on one line and the next word on the other line). Ranorex grabbed both lines according to the screen shot.

Ranorex recorded:
/dom[@domain='somewebsite.com']/body/div[2]/div[5]/div/div[2]/div[2]/?/?/a[@innertext='Emotional health']

When I edit the path, Ranorex is able to track to it the combined words successfully

I tried to change the location of the click to upper right or lower left, but at run time it clicks on the wrong link instead of the recorded one.

I have attached a screen shot for reference.
Thank you.
Attachments
EmotionHealth.jpg
EmotionHealth.jpg (23.13 KiB) Viewed 1015 times

Fergal
Certified Professional
Certified Professional
Posts: 354
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: Test Run is not detecting a recorded path

Post by Fergal » Thu Jan 14, 2021 4:30 pm

You could try changing the path so that it only looks for the first word, i.e. to something like:

/dom[@domain='somewebsite.com']/body/div[2]/div[5]/div/div[2]/div[2]/?/?/a[@innertext>Emotional']

I'd also suggesting taking the index values out of the divs in your path, as those values often change on a live website. i.e. your div s would look like this "div/" and not this "div[2]/".

kdreiling
Posts: 26
Joined: Mon Sep 24, 2012 9:45 pm
Location: Kansas City

Re: Test Run is not detecting a recorded path

Post by kdreiling » Thu Jan 14, 2021 5:49 pm

Thank you, Fergal, for your suggestion. I was able to resolve the issue by changing Recorder defaults from None to Pixel. Now the question is do I set the default back to None or keep it on Pixel? I have usually recorded in None, but it isn't clear what best practice is, so I'm inclined to set it back to None. Any suggestions are a learning lesson for me.

Secondly, everything I have recorded up to this point shows all the div[#] with their indexes. Is there a way to avoid that while recording? I have just started this site for automation and would like to get any settings configured now if there is a way that I won't have to touch every recorded line in spy.

I am very weak on the Ranorex paths and am in a learning mode. Anyone please share tips, tricks, reading so I can understand how to tweak these paths to be more robust and successful in execution.

Thanks to all!

Fergal
Certified Professional
Certified Professional
Posts: 354
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: Test Run is not detecting a recorded path

Post by Fergal » Fri Jan 15, 2021 12:33 pm

kdreiling wrote:
Thu Jan 14, 2021 5:49 pm
...do I set the default back to None or keep it on Pixel? I have usually recorded in None, but it isn't clear what best practice is, so I'm inclined to set it back to None....
My preference is to use None whenever possible, because it helps the tests run on different environments and screen resolutions.
kdreiling wrote:
Thu Jan 14, 2021 5:49 pm
...everything I have recorded up to this point shows all the div[#] with their indexes. Is there a way to avoid that while recording?...
I edit those manually using the Spy tool, checking each element after the indexes have been removed, to ensure that Ranorex can still identify it. Others may have a different way of doing this.

kdreiling
Posts: 26
Joined: Mon Sep 24, 2012 9:45 pm
Location: Kansas City

Re: Test Run is not detecting a recorded path

Post by kdreiling » Fri Jan 15, 2021 5:51 pm

Thank you, Fergal:

One additional question. In instances like these why don't the wildcards work ( ?, *, // , ..). Better yet, the Axis route (descendants, self, parent, etc). I was under the impression that is what these were for to shorten the path, without compromising the robustness of the run. I made need to go back to webinars and user guide to gain a better understanding.