Using unique ID instead of XPATH?

Ask general questions here.
Julie.Toussaint
Posts: 15
Joined: Wed Feb 08, 2023 10:47 am

Using unique ID instead of XPATH?

Post by Julie.Toussaint » Thu Apr 27, 2023 3:54 pm

Hello,

The type of project we use Ranorex test automation on is a WPF app. We store our objects in repositories that have layered folders with XPATH, but want to speed up the total duration of our test sequence by using selector id instead (example: .test-form-div-abc). We are investigating ways to make it possible.

What is the best way to implement this? Currently we plan on assigning a unique AccessibleName value for each part of the forms and letting ranorex find that specific value without XPATH.
Application Engineer 🇧🇪
The workaround experience, awaiting a reply

User avatar
doke
Posts: 112
Joined: Fri Mar 29, 2019 2:33 pm

Re: Using unique ID instead of XPATH?

Post by doke » Tue May 02, 2023 11:12 am

Hi Julie,

1.Did you already expiriment with the <speed vs robustness> slider on settings-advanced tab ?
I would make 2 new projects each with slider at opposite end and make a simple recording (same for each project).
Then check if there is very much change in execution time between those to projects.

2.When using the spy,use the 'browser & results' tab, press enter in the xpath bar to have ranorex (re)find your item, on the bottom of the spy screen, the time needed to find the element is shown.
for my simple page it shows that shortening the xpath is increasing recognition speed:
/dom[@page='MyPage']/body/div[#'MyDiv']//a[#'MyButton'] => One element found, 28ms
/dom[@page='MyPage']/body//a[#'MyButton'] => One element found, 14ms
/dom[@page='MyPage']//a[#'MyButton'] => One element found, 7ms
for a complex page,with lots of div's and nested elements it coud be the other way around.Because, by specifing the path less elements have to be analyzed.

My tips for with making test runs quicker:
- make sure no exclamation marks (!) appear in your testreport
- setvalue + set focus to next element can be (much) faster than keypress.
- replace optional actions by popuphandlers if possible.
- optimize frequently used recordings which take more than 15(?) seconds
- dont' use delays but use wait for

Good luck,
Don

Julie.Toussaint
Posts: 15
Joined: Wed Feb 08, 2023 10:47 am

Re: Using unique ID instead of XPATH?

Post by Julie.Toussaint » Fri Oct 27, 2023 12:39 pm

Thank you for your tips.
Conclusion: Finding object without RxPath is not a possibility. Optimization of these paths has helped.
Application Engineer 🇧🇪
The workaround experience, awaiting a reply