Ranorex

English|Deutsch

Ranorex Spy

print friendly page

Download RanorexSpy.exe (160KB)

With the new "HotTracker" feature all dynamically generated controls, control elements or popup menus can be analyzed.


RanorexSpy is a Win32-based utility that gives you information about a selected GUI element. Download and use RanorexSpy to see which kind of GUI elements could be automated with Ranorex.

In most cases, you have two possibilities to manipulate an element of a control. You can call the functions of special control classes or you can use the general functions of the element class. For instance, you can click a checkbox with CheckBox.Click() or CheckBox.Element.DoDefaultAction().

With RanorexSpy you can find the properties of a selected item as follows:

  1. Arrange your windows so that RanorexSpy and the subject window are visible.
  2. Drag the Finder Tool to the desired window or control item. As you drag the tool, detailed information of the underlying element will be displayed in the dialog box.
To reduce screen clutter, select the Stay on top option on the dialog box. This leaves the RanorexSpy dialog box visible on top of your other applications.

RanorexSpy shows the following properties of elements:

Control Box

EntryDescription
Handle

The unique ID of this window or control. Window handle numbers are reused; they identify a window only for the lifetime of that window. That's why one cannot use this property to find a window or control.


The display mode can be switched between hex or decimal. Most of the RanorexCore functions work with handles. You can use them to check the return value of functions.
Caption/textThe text in the window caption or text contained in a window if it is a control.
Class nameThe name and instance number of the window or control class.
Control nameThe name of the control. Controls don’t have names in older windows applications. If a control has a name, you should search for the control by its control name with the FindName function. If the name field is empty, you should search for the control by its control ID.
Control IdIf the window being displayed is a child window, the control ID label is displayed.
StyleA combination of class style codes.
RectangleThe rectangle surrounding the window. The size of the rectangle is also displayed. Units are pixels in screen coordinates.

Element Box

EntryDescription
RoleThe Role property describes the type of a user interface element. All elements have a Role property. In many cases the object's role is obvious. For example, windows have the Window role and push buttons have the PushButton role. The Role property is retrieved by calling Control.Element.Role in C# code. The role constants are defined in the enumerator Role.
Name

The Name property is a string used to identify, find, or announce an element. All elements support the Name property, but the Name property can also be empty. For example, the text on a button control is its name, while the name for a list box or edit control is the static text that immediately precedes the control in the tabbing order. Even graphic objects that do not display a name provide text when queried for the Name property. The Name property is retrieved by calling Control.Element.Name in C# code. An element's name should be intuitive so that users understand the object's meaning or purpose. The Name property should be unique relative to any sibling objects in the parent.

Class

The Class property shows the class name of the element.

Position

The Position property shows the screen location of an element, the coordinates of the specified object's surrounding rectangle. If the object is not shaped like a rectangle, the method returns the coordinates of the smallest rectangle that encompasses the entire object.

Value

The Value property provides a textual representation of the visual information contained in an element. Not all objects support the Value property. The Value property is retrieved by calling Control.Element.Value in C# code. The Value property tells the client about the visual information contained in an element. For example, an edit control's value is the text it contains, whereas a menu item has no value.

State

The State property describes an object's state at a moment in time. All objects support the State property. The State property is retrieved by calling Control.Element.State in C# code. The State enumerator provides constants that are combined to identify an element's state.

Default action

Shows the default action associated with this element.

The Role and Name property

The most impotant properties for use in automating software are Role and Name. The Role and Name combination should be unique for each GUI element belonging to the same control.

Check the Role and Name property of the elements in your application. If the elements have no Name, discuss the problem with the developer. They should set the "Accessibility Name" property for all elements.

However, if for some reason two GUI elements in a window have the same Role and Name, the additional property Class can be used to uniquely identify the element.

Use the function Element.FindChild to search an element in a control. FindChild searches recursively for each element, it retrieves the role, name and class name for each element and compares them with the requested arguments. If there is a match, FindChild returns an element.

Actions on Elements

One of the most important function is DoDefaultAction if you want to manipulate an element.

A default action is defined for each GUI element role. For instance, the default action for a Button is "push this button", and for a selected checkbox it is "uncheck".

RanorexSpy shows the default action for each element, but not all elements support a default action.

Emulating Keyboard and Mouse Input

If you want to manipulate an element that doesn't support the accessibility properties, the easiest solution is mouse and keyboard input emulation. For instance, you can use tab emulation to navigate to the desired element in a website.

Automate the Elements of a Control

To automate a GUI element, you must obtain information about it. Use RanorexSpy to show the properties of the control and its elements. Find the control with the Application or FormFind functions, search the elements with Element.FindChild(role, name, className) and than emulate keyboard and mouse inputs.