2 out of 7 rated this helpful - Rate this topic

UISpy.exe (UI Spy)

The UI Spy tool enables developers and testers to view and interact with the user interface (UI) elements of an application. By viewing the application's UI hierarchical structure, property values, and raised events, developers and testers can verify that the UI they are creating is programmatically accessible to assistive technology devices such as screen readers. 

UI Spy uses the UI Automation libraries. UI Automation is the new accessibility framework for Microsoft Windows.

Using UI Spy, developers and testers can check an application's level of accessibility by verifying the following:

  • UI Automation property values for UI items.

  • Control pattern implementation.

  • UI Automation event information.

  • Navigation and keyboard focus.

NoteNote

UI Spy is installed with the Microsoft Windows SDK. It is located in the \bin folder of the SDK installation path (uispy.exe) or can be accessed from the Start menu (Start\All Programs\Microsoft Windows SDK\Tools\UISpy).

This topic contains the following sections.

The following graphic shows the main UI Spy windows. The default windows include the following:

  • Control View pane, which contains the hierarchical structure of the application's UI items. Other views are Custom, Content, and Raw. When UI Spy is opened, the pane displays the Desktop node and its first-level children nodes.

  • Properties pane, which displays the property values for the selected UI item.

  • Output pane, which shows the events and UI Automation exceptions raised by an application.

The main window of the UI Spy tool
Note Note

In Vista, right-click and select Run as administrator when launching UI Spy. This is necessary to ensure UI Spy has access to all UI Automation details from applications running with higher privilege.

UI Spy provides two ways to select a UI item: focus tracking and hover mode. Both methods will select an AutomationElement. Once an item is selected, a rectangle is drawn around the item. The selected item is shown in each of the opened View windows and UI Automation properties for the item are displayed in the Properties window.

Focus Tracking Mode

When you use UI Spy's focus tracking, the tool follows the UI item that has keyboard focus. Common uses for focus tracking include stepping through UI items to ensure that each item can receive keyboard focus.

Hover Mode

When you use UI Spy's hover mode, you select a UI item by clicking and holding CTRL for a specific amount of time. To configure the amount of time, on the Edit menu, click Settings. Hover mode is convenient when you want to select a specific UI item.

There are no command line arguments for this tool.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Here're some replacements
Most known is WPF Inspector and Snoop, you can do almost everuthing with it
UI Automation Verify (UIA Verify)
The UI Spy tool seems to be no longer included in recent SDKs. $0There seems to be a community made replacment for this at http://uiautomationverify.codeplex.com/$0 $0$0 $0 $0If anyone is still interested in the original tool, it is made available as a standalone download e.g. at http://andrewtokeley.net/archive/2009/09/15/uispy-ndash-download-it-here.aspx$0
Is Inspector.exe its substitution?
As I have searched, I found an article mentioned that Inspector which shipped with windows 7.0 SDK provide the nearly the same function of UISpy, so I assume this may be its substitution.
Article incorrect - UISpy not installed with SDK v7.1

Article incorrect - UISpy not installed with SDK v7.1

Edit:

In the release notes of Microsoft Windows SDK v7.1. In the section "1.3 What’s Been Removed?" it is mentioned "UISpy.exe" and "Wpt_arch.msi" were removed. UISpy was previously available in Microsoft Windows SDK v6.1.

Suggestion
So if UISpy is not part of Win SDK 7+, then where can we get later versions?  Is it OK to install Win SDK 6.0a over 7.0a?  I did this before and my development environment did not work the same afterwards.

- Rashad Rivera