Lesson 9: Ranorex Spy

As a stand alone tool the Ranorex Spy provides all the functionality needed to explore and analyze applications or websites under test - including their controls and UI elements. After starting Ranorex Spy the element browser contains all currently running applications from your Windows desktop.

Ranorex Spy - applications and their UI elements
Ranorex Spy - applications and their UI elements

The element browser tree shown on the left side represents the computer's desktop with all currently opened applications. The name of the root node is set to the machine's host name. By selecting one of the elements from the browser tree, the Spy provides more detailed information about the selected item in the tabs ‘Overview’, ‘Detail’ and ‘Screenshot’ shown on the right. Ranorex recognizes over 30 of the most commonly known types of UI elements. In Ranorex vocabulary they are called 'adapters'. Every element shown within the element tree of Ranorex Spy is represented by a Ranorex UI Adapter. If Ranorex is not able to specify the type of adapter of a UI element it will be displayed as Unknown.

The 'Overview' tab is the most important view into the details of a UI element. The available attributes and their values are divided into the following sections:

  • 'General'
  • Logical adapters like 'Form', 'Button' or 'Text'
  • Technology related adapters like 'Control', 'Accessible' or 'NativeWindow'

Ranorex Spy 'Overview' tab shows detailed information of a button
Ranorex Spy 'Overview' tab divided into three attribute sections

General

Regardless of what type of UI element is currently selected the 'General' section provides information about whether the element is enabled, valid or visible.

Logical adapters like 'Form', 'Button' or 'Text'

Regardless of what technology is used from the application under test, Ranorex tries to abstract it with logical adapters. These adapters are also used within repositories and provide class specific attribute values like the text value or the state of a button.

Technology related adapters like 'Control', 'Accessible' or 'NativeWindow'

This type of adapter is used to group technology related information like the 'ControlName' of a .NET WinForms button or the process name of an application.

All attributes shown within this tab are accessible during an automated test for validation. Depending on the type of a UI element, they may also be used to set values, too. Learn more about how to use different adapters to read and set attribute values here.

In addition all attributes can be used within the RanoreXPath. By default the attribute written in bold is automatically used to identify the UI element.

Attribute 'ControlName' is used in RanoreXPath expression to identify the button in a form
Attribute 'ControlName' is used to identify the button
The RanoreXPath expression shown in the figure above can be seen as a navigation path through the element browser tree used to identify a UI element. You can use the RanoreXPath Editor to change element identification or edit the path expression directly within the text box's RanoreXPath Edit Mode.

Capture Screenshot Files for Image Based Search

Use the context menu item 'Capture Screenshot' to create an image file (format PNG format) which can be used to search for images in test automation code.
Capture a screenshot from a UI element to save as PNG file
Specify the image region using the toolbar button 'Select Image Region' and click the 'Save' button to save the selected region as a PNG file.

Toolbar short cuts
 
Browse Local Host Shows currently running host applications
Refresh Updates the current state of applications
Load from Snapshot Loads an existing Ranorex snapshot file
Save as SnapshotSaves all UI elements from the tree view to a Ranorex snapshot file
Highlight Elements
When switched on, highlights selected UI elements on the users desktop

Context menu
 
Add to Repository Adds the current element to a Ranorex Repository
Set Element as Root Sets the currently selected element as root element
Refresh Updates all attributes of the specified UI element
Save as Snapshot Saves the current UI element including the child structure to a Ranorex snapshot file
Add Class or Process name to GDI capture list Specifies whether the element's class or process name should use the GDI Plug-In to turn on text based object recognition
Highlight Element Highlights the current element
Capture Screenshot... Captures a screenshot from the current element to be used for further image based validation