Xpath change broke automation

Ask general questions here.
Posts: 12
Joined: Fri Sep 06, 2019 2:21 pm

Xpath change broke automation

Post by AviatorFly » Tue Feb 11, 2020 4:00 pm


I am fairly new still and I am coming back to use Ranorex after a few months break. My existing code was looking for a username entry box that had the xpath set to:


After I ran it, it could not find the username entry box anymore. I used the spy tool and noticed that the xpath is now:


Is there someway I can make this more robust so that it could still find it? Is there a way to reference by name instead of the xpath?



User avatar
Support Team
Site Admin
Site Admin
Posts: 12139
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Xpath change broke automation

Post by Support Team » Tue Feb 11, 2020 10:36 pm

Hi AviatorFly,

It appears there may be some dynamic elements in the AUT that change the structure of the application, and therefore break the RxPath to this element. The easiest solution to this is to remove all the differences between the two RxPaths. The below RxPath will work in both scenarios:

Code: Select all

If we want to be extra robust, we can use the below, however this can cause a decrease in performance and may cause Ranorex to find the wrong element if there is more than one input with the name 'username'.

Code: Select all

For more information on handling dynamic content, check out this user guide page and blog post.

Also, in the newest versions of Ranorex, you can edit the RanoreXPath settings to generate a more robust RxPaths by default when adding a new element so that you do not need to manually edit them to be robust.
1.png (26.16 KiB) Viewed 144 times
I hope this helps!