UI Spy Tasks
This section explains how to perform common UI Spy tasks.
This topic contains the following sections.
- View the UI Automation Tree
- Verify Property Information
- Use Control Patterns
- Monitor Events
- Work with Snapshots
- Related Topics
View the UI Automation Tree
When you start UI Spy, the Control View of the UI Automation tree is displayed. You can access other views (Content or Raw) of the UI Automation tree from the View menu. For more information about views of the UI Automation tree, see UI Automation Tree Overview.
To view a specific UI item and its descendants in the UI Automation tree, select the UI item in the appropriate View pane and click CTRL + >, or right-click and select Scope To Element. The UI item and its descendants appear in the View pane, and the highlighted item's properties appear in the Properties pane. To refresh the full UI Automation tree, deselect Scope to Element. To refresh the entire tree, press F5.
If you have implemented a UI Automation provider for a UI item and you have properly implemented navigation, or if you are using a control with support for UI Automation such as comctl32, the UI item is displayed at the correct level within the UI Automation tree. For example, the navigation for a dialog box that includes an edit control has been properly implemented if the UI Automation tree for the control shows the edit control as a child node below the dialog box.
Verify Property Information
When you start UI Spy, the Properties pane is displayed in the right-hand side of the main window. To configure which UI Automation properties displayed, open the View menu and select Configure Properties. The Properties Selection window opens and enables you to configure the list of properties that appear in the Properties pane. If you have implemented a UI Automation provider, or if you are using a control with support for UI Automation such as comctl32, UI Spy displays the UI Automation properties.
Use Control Patterns
UI Automation control patterns provide a way to categorize and expose a control's functionality independent of the control type or the appearance of the control. For example, you use the Invoke control pattern for controls that can be invoked (such as buttons), and the Scroll control pattern for controls that have scroll bars (such as list boxes, list views, or combo boxes). When a UI Automation provider[Glossary Lookup Failure: ui_automation_provider#af345bc0-5a9f-4e00-9964-0727e786adfa] implements one of these control pattern interfaces, UI Automation clients[Glossary Lookup Failure: ui_automation_client#d52a491a-2534-4290-88b5-b03a2564fca7] can use corresponding classes to programmatically manipulate the UI item. For more information on control patterns, see UI Automation Control Patterns Overview.
UI Spy enables you to use control pattern classes to manipulate UI items. You can choose from a list of implemented control patterns, choose a method from a control pattern class and specify parameters for the method. UI Spy calls the method and displays any output in the Output window.
UI Spy displays UI Automation events. As applications raise events, UI Spy handles them and displays them in the Output window. You can choose the events you want to monitor and specify when to start and stop monitoring events.
Work with Snapshots
UI Spy enables you to define a snapshot of the UI and save UI Automation information for that snapshot to an XML file. You can save the information from a specified point or from the root directory.
Saving all of the information from the UI Automation tree from the root can be time-consuming.
If you have previously saved a snapshot, you can load that snapshot and UI Spy displays a bitmap version of the UI Automation tree. Property values are displayed in the Properties window.