This topic introduces you to the features of User Interface (UI) Automation, the new accessibility framework for Microsoft Windows. UI Automation provides programmatic access to an application's user interface (UI), which allows assistive technology products such as screen readers to provide information about the UI to end users. It also allows automated test scripts to interact with the UI.

UI Automation has two main audiences: developers of UI Automation clients and developers of UI Automation providers. UI Automation clients are assistive technology products such as screen readers, screen enlargers, and alternative input devices. Automated test scripts are also considered clients in the UI Automation framework. UI Automation providers are controls in an application and applications such as Microsoft Word, Excel, or third-party applications based on the Windows operating system.

Standard Windows programming has always exposed the relationship between elements in the UI in a parent/child relational structure. UI Automation clients view the UI elements on the desktop as a set of automation elements that are arranged in a tree structure. Automation elements implement a common class (AutomationElement) to enable consistent information, interaction, and navigation. UI Automation unifies disparate UI frameworks such as Windows Presentation Foundation (WPF), Trident, and Win32 so that code can be written against one application programming interface (API) rather than several.

Within the UI Automation tree, the root automation element represents the current desktop and its children represent application windows on the desktop. Each of these child elements can contain automation elements that represent the application's UI, such as menus, buttons, toolbars, and listboxes. Each piece of UI can contain additional automation elements that represent its content, such as items in a menu or a list. Even a button, which does not contain any items, can have child automation elements that represent the basic UI components comprising the button, such as text and rectangles.

Note: The UI Automation tree is not a fixed structure. For performance reasons it is built on demand, starting with an automation element that the UI Automation client specifies.

The UI Automation tree can be filtered to create customized views of the tree that contain only those automation elements relevant for a particular client. This approach allows clients to customize the structure presented through UI Automation to meet their particular needs. A few default views are provided by the UI Automation framework, but clients can also define custom views if they need additional control.

UI Automation uses control patterns to express the functionality contained in controls. A control pattern differentiates between what a user would call the control and what can be done with the control programmatically by using patterns to express only the control's functionality, separate from the type or name of that control. Control patterns can be combined to define the full functionality of a control.

UI Automation providers implement control pattern interfaces on the UI in their applications. UI Automation clients access methods and properties of control pattern classes and use them to access information about the UI. For example, a WPF application can implement ISelectionProvider and ISelectionItemProvider on a ListBox and a client can call AddToSelection from the SelectionItemPattern class to add an item to the currently selected items in a multi-selectable selection container.