How do I make a more robust Ranorex Xpath?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
JackCasey
Posts: 1
Joined: Mon Feb 20, 2023 7:25 pm

How do I make a more robust Ranorex Xpath?

Post by JackCasey » Fri Sep 01, 2023 8:59 pm

nestbutton.rxsnp
<t>Hello, <br/>
<br/>
I have run into an issue where every time I test a new version of my company’s software, the test breaks. Each time the test breaks I have checked the new version with Spy and I have noticed that Spy generates a different Xpath for elements with the new version compared to the Xpath searched for by the test.<br/>
<br/>
This is an example of an Xpath from the new version compared to an Xpath within the test:<br/>
<br/>
Test Xpath: [language=]/form[@automationid='ParentForm'] //button[@accessiblename='Add Job'][/language]<br/>
New Version Xpath: [language=]/form//button[@accessiblename='Add Job'][/language]<br/>
<br/>
I have tried to use different attributes and operators to make the Xpath stronger, but I can’t seem to get any consistency. I would love some suggestions. <br/>
<br/>
Also, just to provide some context, I’m creating these tests on a Windows 10 machine with Ranorex Studio 10.7.1. The software I’m testing has a user interface created with DevExpress WinForms. I have also included a snapshot of the element.</t>
You do not have the required permissions to view the files attached to this post.

IvanF
Posts: 139
Joined: Thu Aug 11, 2022 8:55 pm

Re: How do I make a more robust Ranorex Xpath?

Post by IvanF » Fri Sep 01, 2023 9:17 pm

You can check the robustness setting referenced in this thread: robust-path-disabling-t20538.html

and also a few tips about weighting attributes in this section of the user guide: https://support.ranorex.com/help/latest ... roduction/

In general, automationId is rather tricky, so if you have other attributes to rely on and you can skip the form with // , that is preferable.