Tracking the relevant object with Spy 2.2

Ranorex Spy, Recorder, and Studio.
apilz
Posts: 2
Joined: Wed Apr 21, 2010 4:09 pm

Tracking the relevant object with Spy 2.2

Post by apilz » Wed Apr 21, 2010 4:46 pm

Hello,

I have a question concerning the tracking of GUI elements that I will try to explain using the calculator application of Windows 7.

When I tried to track the control that holds the calculation result with Ranorex Spy 1.5.3, I get the control I'm expecting:
spy_1_5.png
spy_1_5.png (37.64 KiB) Viewed 1085 times
However, the tracking function of Ranorex Spy 2.2 points me to a control that does not hold the expected value:
spy_2_2_a.png
spy_2_2_a.png (79.86 KiB) Viewed 1085 times
The control actually holding the value is in a different hierarchy:
spy_2_2_b.png
spy_2_2_b.png (81.22 KiB) Viewed 1085 times
I get the same unexpected control when using Element.FindFromPoint() of the API.

So my first question is why Spy 1.5.3 appears to bring the more reliable result and how to get it with version 2.2 (without changing the system under test) and how I can find the "correct" control with FindFromPoint.

A second question that occured to me is why MenuItems in a MenuBar do not appear to have child elements in the element browser. When I track them they appear as ContextMenu that is not a descendant of the form but only the host. I can also not find them as child elements of the MenuItems via the API which I remember to have been able to with Ranorex 1.5.3. Did I overlook something?

Thanks,
Alex

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Tracking the relevant object with Spy 2.2

Post by Support Team » Wed Apr 21, 2010 5:33 pm

Hi Alex,

The FromPoint() issue is a problem specific to the Windows 7 calculator which works with Ranorex Spy 1.5 because of pure luck :?

We did stumble on the Calculator issue after trying to move the Calculator sample to Windows 7 but decided not to do anything about it because we couldn't find anything else in Win 7 which had a similar problem. (As a workaround I suggest copying calc.exe from Windows XP which works great in Win7 ;)

The menus now generally work like this in Ranorex 2. In Ranorex 1.5, menus were restricted to Win32 HMENUs and some variants of MSAA menus. In Ranorex 2.x every popup window (including menu windows and context menus) is mapped to the top level (this is the 1:1 operating system representation). Because of the technology mix supported by the new Ranorex version, this is not the case everywhere, for example in Flash/Flex, Silverlight and WPF where the mapping of menu items is different.

Usually it is best to work with menu items by using paths like this:

/contextmenu//menuitem[@text='foo']

Edit: tooltips also work like this (for example "/tooltip")

If you are interested in working with only one process, you can use the @processid and @processname attributes to filter your search results on the top level.

As a general note, Ranorex 2.x was not intended to be compatible with Ranorex 1.x so there are many differences.

Michael
Ranorex Team
.
Image

apilz
Posts: 2
Joined: Wed Apr 21, 2010 4:09 pm

Re: Tracking the relevant object with Spy 2.2

Post by apilz » Fri Apr 23, 2010 11:51 am

Hi Michael,

thanks for the quick and helpful answer. This implies, however, another question to me: is there a possibility to find MenuIntems in ContextMenues without actually clicking on Elements that have a HasPopup state?

Thanks,
Alex

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Tracking the relevant object with Spy 2.2

Post by Support Team » Fri Apr 23, 2010 12:41 pm

Yes, you are right. In Ranorex 2 there is currently no possibility to do that, which might not be optimal if you are trying to capture the whole application state ...
Another problem is that those menus might not even exist if they are not visible, or worse, are not up-to-date which is no issuewith some applications but becomes one with more complex 3rd party control libraries.

Some technologies like WPF provide a duplicate mapping e.g. /contextmenu/menuitem and /form/menubar/menuitem/menuitem

Michael
Ranorex Team
.
Image