共用方式為


UI Spy (UISpy.exe) 

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.

This topic contains the following sections.

  • Using UI Spy
  • UI Spy Modes
  • Command Line Arguments
  • Related Topics

Using UI Spy

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.

Screenshot of applet window with two panes

Note that you may need to run UI Spy as an administrator in order to be able to see all UI items.

UI Spy Modes

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.

Command Line Arguments

There are no command line arguments for this tool.

See Also

Concepts

UI Spy Tasks
UI Spy Keyboard Shortcuts

Other Resources

UI Automation Overview
UI Automation Tree Overview
UI Automation Properties Overview
UI Automation Control Patterns Overview