Ranorex not finding objects in new version of AUT

Ask general questions here.
User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Ranorex not finding objects in new version of AUT

Post by Ciege » Fri May 15, 2009 4:42 pm

Hi all,

I just installed a new version of our AUT. In this new version Ranorex is not able to find objects using my existing code.

For example, to find a button on the toolbar I use this code (removed some code for simplicity):

Code: Select all

Ranorex.Form RanorexFormName = Host.Local.FindSingle("/form[@title~'Hard Dollar.*']", 10000);
RanorexFormName.EnsureVisible();
RanorexFormName.Activate();
Ranorex.Button Button = RanorexFormName.FindSingle(".//button[@accessiblename='Resource Rate']", 10000);
RanorexSpy shows the EXACT same path in to that button in both the new and old AUT:

Code: Select all

/form[@controlname='frmMainDialog']/toolbar/*/button[@accessiblename='Resource Rate']
In the old AUT this works just fine. In the new AUT I get the following exception:

Code: Select all

Ranorex.ElementNotFoundException: No element found for path './/button[@accessiblename='Resource Rate']'within 10s.
   at Ranorex.Core.Element.FindSingle(RxPath path, Duration timeout)
   at Ranorex.Adapter.FindSingle(RxPath path, Duration timeout)
   at H_ReportsTest.Program.Main(String[] args) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\H$ReportsTest\H$ReportsTest\Program.cs:line 44
In the new AUT if I do a FindSingle on the entire path that RanorexSpy shows it does indeed find the button.

Code: Select all

Ranorex.Button Button = RanorexFormName.FindSingle("/form[@controlname='frmMainDialog']/toolbar/*/button[@accessiblename='Resource Rate']", 10000);
Any ideas? Can you see something I am doing wrong?

Thanks...

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Post by Ciege » Fri May 15, 2009 5:58 pm

Forgot to mention, I am using the version 2.0.2.5954 of Ranorex. It was a debug version that was sent to me for another issue.

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Post by Ciege » Fri May 15, 2009 6:16 pm

Just for grins I did the following:

I added some debug code:

Code: Select all

int ChildCount = RanorexFormName.Element.ChildIndex;
Report.Debug("Form Child Index Count: " + ChildCount);

Report.Debug("Form FlavorName: " + RanorexFormName.Element.FlavorName);
foreach (Unknown child in RanorexFormName.Element.Children)
    Report.Debug(child + " FlavorName: " + child.Element.FlavorName);
Then did this search for the immediate child element toolbar:

Code: Select all

Ranorex.ToolBar Toolbar = RanorexFormName.FindSingle(".//toolbar[@controlname='mToolBar']", 5000);
This was the result:

Code: Select all

[2009/05/15 10:12:41.531][Debug  ][User]: Form Child Index Count: 4
[2009/05/15 10:12:41.531][Debug  ][User]: Form FlavorName: winforms
[2009/05/15 10:12:42.015][Debug  ][User]: {ToolBar:mToolBar} FlavorName: winforms
[2009/05/15 10:12:42.031][Debug  ][User]: {Container:mMenu} FlavorName: winforms
[2009/05/15 10:12:42.031][Debug  ][User]: {StatusBar:stbarAppStatus} FlavorName: winforms
[2009/05/15 10:12:42.062][Debug  ][User]: {Unknown:MainInterface} FlavorName: winforms
[2009/05/15 10:12:42.078][Debug  ][User]: {MenuBar:System} FlavorName: msaa
[2009/05/15 10:12:42.078][Debug  ][User]: {TitleBar:Hard Dollar - [CBS (Cost Breakdown Structure) - Training Job : Training Job - Maricopa County No. TM2924]} FlavorName: msaa
[2009/05/15 10:12:48.250][Failure][User]: Fatal error: Ranorex.ElementNotFoundException: No element found for path './/toolbar[@controlname='mToolBar']' within 5000ms.
   at Ranorex.Core.Element.FindSingle(RxPath path, Duration timeout)
   at Ranorex.Adapter.FindSingle(RxPath path, Duration timeout)
   at H_ReportsTest.Program.Main(String[] args) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\H$ReportsTest\H$ReportsTest\Program.cs:line 53

So, even though the debug code shows that the toolbar child element exists, the FindSingle could not find the toolbar. I don't get it...

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

Post by Support Team » Mon May 18, 2009 3:01 pm

Can you try to increase the Timeout at the RanorexFormName.FindSingle method to 30000 (30sec).
It seems like the current timespan is not long enough.

In the next few days we will release a new Version (2.1) which fixes a performance issue with the FindSingle method when using the "//" operator (descendant-or-self axis).

Kind regards,

Ranorex Team

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Post by Ciege » Mon May 18, 2009 4:06 pm

I've tried again with a 30 second and 60 second delay. Both of them fail.

As I said earlier the exact code works correctly in the previous version of my AUT. And, RanorexSpy shows the exact same XPath to the objects in both versions of the AUT. If I use the full XPath in my FindSingle it works. It only fails as soon as I use a .//.

Thanks.

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

Post by Support Team » Wed May 20, 2009 9:25 am

We found a performance issue regarding FindSingle() and ".//xyz" style paths.

Could you try something like this and measure how long it takes ?

IList<Element> result = RanorexFormName.Find(".//*");
(and result.Count would also be interesting)

In your case, this should take longer than the timeout for your ".//toolbar" - search. The problem should go away with 2.1. Stay tuned, we will release in the next few days.

Michael
Ranorex Team

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Post by Ciege » Wed May 20, 2009 6:38 pm

OK, here are the details:

Run 1:

Code: Select all

[2009/05/20 10:16:32.462][Debug  ][User]: Form Child Index Count: 6
[2009/05/20 10:16:32.493][Debug  ][User]: Form FlavorName: winforms
[2009/05/20 10:16:32.805][Debug  ][User]: {ToolBar:mToolBar} FlavorName: winforms
[2009/05/20 10:16:32.805][Debug  ][User]: {Container:mMenu} FlavorName: winforms
[2009/05/20 10:16:32.805][Debug  ][User]: {StatusBar:stbarAppStatus} FlavorName: winforms
[2009/05/20 10:16:32.837][Debug  ][User]: {Unknown:MainInterface} FlavorName: winforms
[2009/05/20 10:16:32.837][Debug  ][User]: {MenuBar:System} FlavorName: msaa
[2009/05/20 10:16:32.837][Debug  ][User]: {TitleBar:Hard Dollar - [CBS (Cost Breakdown Structure) - Training Job : Training Job - Maricopa County No. TM2924]} FlavorName: msaa

[2009/05/20 10:16:32.837][Info   ][User]: Start Find .//*
[2009/05/20 10:19:27.774][Info   ][User]: Stop Find .//*
[2009/05/20 10:19:27.805][Info   ][User]: Find .//* count: 13376

[2009/05/20 10:19:33.712][Failure][User]: Fatal error: Ranorex.ElementNotFoundException: No element found for path './/button[@accessiblename='Resource Rate']'within 1m.
   at Ranorex.Core.Element.FindSingle(RxPath path, Duration timeout)
   at Ranorex.Adapter.FindSingle(RxPath path, Duration timeout)
   at H_ReportsTest.Program.Main(String[] args) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\H$ReportsTest\H$ReportsTest\Program.cs:line 55

Run 2:

Code: Select all

[2009/05/20 10:31:54.446][Debug  ][User]: Form Child Index Count: 5
[2009/05/20 10:31:54.446][Debug  ][User]: Form FlavorName: winforms
[2009/05/20 10:31:54.915][Debug  ][User]: {ToolBar:mToolBar} FlavorName: winforms
[2009/05/20 10:31:54.915][Debug  ][User]: {Container:mMenu} FlavorName: winforms
[2009/05/20 10:31:54.915][Debug  ][User]: {StatusBar:stbarAppStatus} FlavorName: winforms
[2009/05/20 10:31:54.962][Debug  ][User]: {Unknown:MainInterface} FlavorName: winforms
[2009/05/20 10:31:54.977][Debug  ][User]: {MenuBar:System} FlavorName: msaa
[2009/05/20 10:31:54.977][Debug  ][User]: {TitleBar:Hard Dollar - [CBS (Cost Breakdown Structure) - Training Job : Training Job - Maricopa County No. TM2924]} FlavorName: msaa

[2009/05/20 10:31:54.977][Info   ][User]: Start Find .//*
[2009/05/20 10:35:18.493][Info   ][User]: Stop Find .//*
[2009/05/20 10:35:18.602][Info   ][User]: Find .//* count: 13376
The difference between this version of my AUT and the previous version of my AUT is the new DevExpress tables. Previous AUT used an old version of DevExpress that Ranorex could not read. The new version of AUT uses a new version of DevExpress that Ranorex can read. So there are a lot more objects to traverse now for Ranorex to search through.

However, as you can see above, it took just shy of 3 minutes to get the result of the Find .//* code. Another run of the same code above resulted in about 3 1/2 minutes so I would need to run this several times to get a good average. Will do that if you want me to but I have not done that yet.

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Post by Ciege » Wed May 20, 2009 11:00 pm

Just installed 2.1.0.06243.

The find .//* is still about 2 1/2 minutes - 3 1/2 minutes.

However, all my FindSingle(.//) calls now seem to be working correctly with time outs of 5000ms (5 seconds). So it would seem that whatever performance fix you guys made appears to be paying off.

Great job again! Hopefully this matter can now be put to rest.

Thanks!