Page 1 of 1

why is Relative path slow

Posted: Tue Apr 02, 2019 11:37 am
by rsudhak
Hi All,

When I use relative path in my repo , the test run takes too long , any idea ?

my repo item loooks like this :
.//text[@name='Design Length']/following-sibling::text

which is under /form[@title='Settings' ]

Re: why is Relative path slow

Posted: Tue Apr 02, 2019 11:42 am
by odklizec
Hi,

Sadly, without seeing the application's snapshot, it's hard to tell anything definitive. My best guess is that the xpath is too general and it simply takes too long to search entire app for "Design Length" element and its nearest text? Could you please post a Ranorex snapshot (NOT screenshot) of tested app?

Re: why is Relative path slow

Posted: Tue Apr 02, 2019 12:20 pm
by rsudhak
how can I take the snapshot of the current repo?

Re: why is Relative path slow

Posted: Tue Apr 02, 2019 12:30 pm
by odklizec
Hi,

You must follow the steps described here:
https://www.ranorex.com/help/latest/ran ... hot-files/

Basically, you must set the app to the expected state, when the repo element is available in UI. Then via Spy, you can create the snapshot of given element. But in your case, i would suggest to save snapshot of entire app and not just the given element. In Spy, select root element of tested app and save its snapshot.

Re: why is Relative path slow

Posted: Tue Apr 02, 2019 12:38 pm
by rsudhak
snapshot attached

Re: why is Relative path slow

Posted: Tue Apr 02, 2019 12:52 pm
by odklizec
Hi,

As I've expected, the path is simply too short for the UI. Just expand all tree nodes and you will quickly see how many elements there is. And your xpath makes Ranorex to go through all of them, to find all appearances of text[@name='Design Length']. So I would suggest to add few more items to the xpath, like this...
form//element[@classname='FinalCircuitCableView']/container[@classname='ScrollViewer']//text[@name='Design Length']
At next, you are using somewhat old and no longer supported version 8.3.1! It's time to upgrade to, at least, 8.3.3 or 9.0 ;) And finally, there is issued a WPF instrumentation warning, which means that Ranorex identification capabilities are limited with your app! You should try to run Ranorex Studio/Spy in administrator mode. This often helps with similar instrumentation warnings.

Re: why is Relative path slow

Posted: Tue Apr 02, 2019 1:54 pm
by qwertzu
hi

in addition to what odklizec already mentioned:
Avoiding double slashes (//) will decrease the search time tremendously.
At least using a question mark for each element in between, instead of the double slash, will be way faster.
However, it always depends on your application if the path is still robust enough afterwards.

regards,
qwertzu

Re: why is Relative path slow

Posted: Tue Apr 02, 2019 2:27 pm
by rsudhak
I will try that, Thank you. The main reason to have a relative path is to avoid maintenance issues, not only that if the same element is in the two different places, I need not have to create two different items in the repo, I believe if we have a relative path and we are on the right page/form, it should be quick to find the elements