Page 1 of 1

Ranorex slow to identify the xpath

Posted: Mon Oct 19, 2015 4:32 pm
by Zhiqiu
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();

Re: Ranorex slow to identify the xpath

Posted: Thu Oct 22, 2015 12:15 pm
by Support Team
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)

Re: Ranorex slow to identify the xpath

Posted: Wed Oct 28, 2015 10:07 pm
by Zhiqiu
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']

Re: Ranorex slow to identify the xpath

Posted: Thu Oct 29, 2015 1:02 pm
by odklizec
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 ;)

Re: Ranorex slow to identify the xpath

Posted: Thu Oct 29, 2015 3:15 pm
by Zhiqiu
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.

Re: Ranorex slow to identify the xpath

Posted: Thu Oct 29, 2015 3:32 pm
by odklizec
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.

Re: Ranorex slow to identify the xpath

Posted: Thu Oct 29, 2015 4:11 pm
by Zhiqiu
Here is the link to the snapshot. Thanks!
https://drive.google.com/file/d/0B8axhw ... sp=sharing

Re: Ranorex slow to identify the xpath

Posted: Thu Oct 29, 2015 4:18 pm
by Zhiqiu
I also screenshot the repository. the highlighted on is the problem. Please advice what I can do so Ranorex speedup the validation.

Re: Ranorex slow to identify the xpath

Posted: Thu Oct 29, 2015 5:02 pm
by odklizec
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']

Re: Ranorex slow to identify the xpath

Posted: Thu Oct 29, 2015 8:07 pm
by Zhiqiu
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']

Re: Ranorex slow to identify the xpath

Posted: Fri Oct 30, 2015 8:23 am
by odklizec
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? ;)