Page 1 of 1

Recorder snapping to the wrong repository element.

Posted: Mon Sep 28, 2015 12:43 pm
by stapes
I have tried to record the same step over and over.
I am clicking A Cancel button on my AddProfile screen.

Ranorex keeps assuming I am clicking a Yes button on a completely different screen.

Then, of course , it fails on replay because it is looking at the wrong stupid button.

How do I guarantee it gets the correct element?

Re: Recorder snapping to the wrong repository element.

Posted: Mon Sep 28, 2015 12:56 pm
by stapes
I solved this by taking a guess, and editing androidelement/text[3] to text[2].

Re: Recorder snapping to the wrong repository element.

Posted: Mon Sep 28, 2015 1:16 pm
by odklizec
Hi,

There is no need to "guess" something. If you try the xpath in Spy, you should see if the path is unique or not. If there is more than just one element found for given xpath, Ranorex always uses the first found.

There are two possibilities why you script clicked wrong element. The xpath you first used was either wrong or it changed between the runs? Unfortunately, using element indexes is the least reliable method to identify elements. If there are no other identification attributes you could use in your xpath, you can try to use relationship operators to find proper element based of related (or completely different) elements.

It would be nice if you could post a Ranorex snapshot from your app and the problematic xpath you are using. Maybe we can suggests better way to identify your element than using element index.

Re: Recorder snapping to the wrong repository element.

Posted: Mon Sep 28, 2015 3:07 pm
by stapes
Thank you for your offer, but I do not rightly understand how to get a snapshot at the moment.

Re: Recorder snapping to the wrong repository element.

Posted: Mon Sep 28, 2015 4:31 pm
by Fergal
stapes wrote:...I do not rightly understand how to get a snapshot at the moment.
You can read how to do that at Creating Ranorex Snapshot Files.