
UI Automation in a Provider
For a UI to be automated, a developer of an application or control must look at what actions an end-user can perform on the UI object using standard keyboard and mouse interaction.
Once these key actions have been identified, the corresponding UI Automation control patterns (that is, the control patterns that mirror the functionality and behavior of the UI element) should be implemented on the control. For example, user interaction with a combo box control (such as the run dialog) typically involves expanding and collapsing the combo box to hide or display a list of items, selecting an item from that list, or adding a new value via keyboard input.
Note: |
|---|
With other accessibility models, developers must gather information directly from individual buttons, menus, or other controls. Unfortunately, every control type comes in dozens of minor variations. In other words, even though ten variations of a pushbutton may all work the same way and perform the same function, they must all be treated as unique controls. There is no way to know that these controls are functionally equivalent.
Control patterns were developed to represent these common control behaviors. For more information, see UI Automation Control Patterns Overview.
|
Implementing UI Automation
As mentioned earlier, without the unified model provided by UI Automation, test tools and developers are required to know framework-specific information in order to expose properties and behaviors of controls in that framework. Since there can be several different UI frameworks present at any single time within Windows operating systems, including Win32, Windows Forms, and Windows Presentation Foundation (WPF), it can be a daunting task to test multiple applications with controls that seem similar. For example, the following table outlines the framework-specific property names required to retrieve the name (or text) associated with a button control and shows the single equivalent UI Automation property.
UI Automation Control Type
|
UI Framework
|
Framework Specific Property
|
UI Automation Property
|
|---|
Button
|
Windows Presentation Foundation
|
Content
|
NameProperty
|
Button
|
Win32
|
Caption
|
NameProperty
|
Image
|
HTML
|
alt
|
NameProperty
|
UI Automation providers are responsible for mapping the framework-specific properties of their controls to the equivalent UI Automation properties.
Information on implementing UI Automation in a provider can be found at UI Automation Providers for Managed Code. Information on implementing control patterns is available at UI Automation Control Patterns and UI Automation Text Pattern.