Ranorex slow to identify the xpath

Ask general questions here.
Zhiqiu
Posts: 8
Joined: Mon Oct 19, 2015 4:18 pm

Ranorex slow to identify the xpath

Post by Zhiqiu » Mon Oct 19, 2015 4:32 pm

We have some UI tests using Ranorex. To catch the performance of UI, we use stop watch. Bellow is the sample code. Right after click, we start the stopwatch. When one of feature(xpath) exists, we stop the stopwatch. But the problem is, we run the same tests every day multiple times. one or two times out of 10 times, we will see the time that stopwatch catches is much longer than what it should be. Normally it takes 4 seconds to load the page with code bellow. But sometimes we see 10, 13 seconds. During those slow time, I observed the test. The UI page has been fully loaded. But Ranorex still shows "searching item xxxx". Why Ranorex couldn't identify the xpath right away when the page has been fully loaded?

repo.Iexplore.Create_Action.Click("Center");
stopwatch.Start();

Validate.Exists(repo.JudicialSummaryApplication.Artifact_Content.Individual_Features.Universal_Summary.Paragraph_ContentInfo);
stopwatch.Stop();

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Ranorex slow to identify the xpath

Post by Support Team » Thu Oct 22, 2015 12:15 pm

Hi Zhiqiu,

In general Ranorex is a GUI automation tool and not designed to do performance test, but such differences in searching an element can be caused by several factors.

One factor could be that the path is not robust enough to identify the element uniquely. Please also note that different processes, which need a lot of resources, can influence the search.

May I ask you to upload a Ranorex Snapshot and a corresponding RanoreXPath of such an element in question? This would allow us to check if the path is robust and unique enough.

Thank you.
Regards,
Markus (S)

Zhiqiu
Posts: 8
Joined: Mon Oct 19, 2015 4:18 pm

Re: Ranorex slow to identify the xpath

Post by Zhiqiu » Wed Oct 28, 2015 10:07 pm

Hi Markus,

Bellow is the xpath we tried to validate. It's a flex object.

.//div[@id~'[0-9]+_judicialsummary.trialCourtOrderSummaryPage.section.widget.universalHierarchyDialog']/flexobject[@id~'[0-9]+_judicialsummary.trialCourtOrderSummaryPage.universalHierarchyWidgetSwfObject']
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex slow to identify the xpath

Post by odklizec » Thu Oct 29, 2015 1:02 pm

Hi,

I think the problem is in the complicated and automation unfriendly structure of your AUT, which makes unique identification of the element in question pretty hard. Because of the use of .// syntax, Ranorex is forced to search the element div[@id~'[0-9]+_judicialsummary.trialCourtOrderSummaryPage.section.widget.universalHierarchyDialog'] in all descendants of the current element (from where it start search). The more descendants there are, the longer it can take. Additionally, the use of regex probably does not help the situation either? But I guess it has much smaller impact on search performance than using // syntax.

So if you want to speed the search up, you will have to add some more elements to the path, like the nearest parent(s) of searched element. But looking at the structure of your AUT, you will most probably have to use some indexes, which are prone to changes and not very recommended to use.

BTW, it would be much easier to help you to find a reliable (faster) path, if you could post a Ranorex snapshot! Using screenshot for constructing xpaths is useless ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Zhiqiu
Posts: 8
Joined: Mon Oct 19, 2015 4:18 pm

Re: Ranorex slow to identify the xpath

Post by Zhiqiu » Thu Oct 29, 2015 3:15 pm

The attachment is the snapshot. Thanks for your help.

I did try to attach the snapshot. Not sure if you see it. Please let me know if you can't view it.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex slow to identify the xpath

Post by odklizec » Thu Oct 29, 2015 3:32 pm

Hi,

No, there seems to be no snapshot attached to your post. Maybe it's too big to be attached (bigger than 3MB)? In this case, use a cloud service (dropbox, onedrive, google drive, etc...) to upload your snapshot and post here a link.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Zhiqiu
Posts: 8
Joined: Mon Oct 19, 2015 4:18 pm

Re: Ranorex slow to identify the xpath

Post by Zhiqiu » Thu Oct 29, 2015 4:11 pm

Here is the link to the snapshot. Thanks!
https://drive.google.com/file/d/0B8axhw ... sp=sharing

Zhiqiu
Posts: 8
Joined: Mon Oct 19, 2015 4:18 pm

Re: Ranorex slow to identify the xpath

Post by Zhiqiu » Thu Oct 29, 2015 4:18 pm

I also screenshot the repository. the highlighted on is the problem. Please advice what I can do so Ranorex speedup the validation.
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex slow to identify the xpath

Post by odklizec » Thu Oct 29, 2015 5:02 pm

Hi,

As I've suspected, your application is automation unfriendly ;) A lot of DIVs in the same folder with no IDs. Using element indexes would be a very risky job, most probably failing with pretty minor GUI changes. Unfortunately, using element classes (as I did in the path below) could be only a minor improvement over the indexes.

The best path you can probably try is something like this...
./body/div[@class='ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable']/div[@class='ui-dialog-content ui-widget-content']/div[@id~'[0-9]+_judicialsummary.trialCourtOrderSummaryPage.section.widget.universalHierarchyDialog']
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Zhiqiu
Posts: 8
Joined: Mon Oct 19, 2015 4:18 pm

Re: Ranorex slow to identify the xpath

Post by Zhiqiu » Thu Oct 29, 2015 8:07 pm

Thank you very much!! I updated the xpath as you suggested. Ranorex found the xpath right away.

Below is another xpath.
div[2]/div[@id~'[0-9]+_judicialsummary.trialCourtOrderSummaryPage.section.widget.featuresWidget']/flexobject[@id='judicialsummary.FeaturesWidget']//container[@id='featuresMode']/container[@id='box']/list[@automationname='FeaturesWidget.summaryFeaturesList']//container[@type='Group']

The xpath above is under the folder with xpath body/div[4].

Do I need to change that xpath to use "@class"(see below) too? which one is better?
body/div[@class='ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable ui-resizable']/div[@class='ui-dialog-content ui-widget-content']/div[@id~'[0-9]+_judicialsummary.trialCourtOrderSummaryPage.section.widget.featuresWidget']/flexobject[@id='judicialsummary.FeaturesWidget']//container[@id='featuresMode']/container[@id='box']/list[@automationname='FeaturesWidget.summaryFeaturesList']//container[@type='Group']

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex slow to identify the xpath

Post by odklizec » Fri Oct 30, 2015 8:23 am

Unfortunately, there is nothing else unique enough (other than "class") in your gui, so yes, the class you picked is probably the best you can try? ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration