Compartilhar via


UI Automation Overview

Observação

Esta documentação destina.Os desenvolvedores do NET Framework que desejam usar o gerenciado UI Automation classes definidas na System.Windows.Automation namespace.As informações mais recentes sobre UI Automation, consulte API de automação do Windows: Automação da interface do usuário.

Microsoft UI Automation is the new accessibility framework for Microsoft Windows, available on all operating systems that support Windows Presentation Foundation (WPF).

UI AutomationFornece acesso programático à maioria user interface (UI) elementos na área de trabalho, a ativação de produtos de tecnologia assistencial como tela leitores para fornecer informações sobre o UI para os usuários finais e manipular o UI por meio diferente de entrada padrão. UI Automationtambém permite que os scripts de teste automatizado interagir com o UI.

Observação

UI Automation does not enable communication between processes started by different users through the Run as command.

UI Automation client applications can be written with the assurance that they will work on multiple frameworks. The UI Automation core masks any differences in the frameworks that underlie various pieces of UI. For example, the Content property of a WPF button, the Caption property of a Win32 button, and the ALT property of an HTML image are all mapped to a single property, Name, in the UI Automation view.

UI Automation provides full functionality in Windows Vista, Microsoft Windows XP, and Windows Server 2003.

UI Automation providers offer some support for Microsoft Active Accessibility client applications, through a built-in bridging service.

Este tópico contém as seguintes seções.

  • Providers and Clients
  • UI Automation Model
  • Tópicos relacionados

Providers and Clients

UI Automation has four main components, as shown in the following table.

Component

Description

Provedor API (UIAutomationProvider e UIAutomationTypes)

A set of interface definitions that are implemented by UI Automation providers, objects that provide information about UI elements and respond to programmatic input.

Client API (UIAutomationClient.dll and UIAutomationTypes.dll)

A set of types for managed code that enables UI Automation client applications to obtain information about the UI and to send input to controls.

UiAutomationCore.dll

The underlying code (sometimes called the UI Automation core) that handles communication between providers and clients.

UIAutomationClientsideProviders.dll

A set of UI Automation providers for standard legacy controls. (WPF controles têm suporte nativo para UI Automation.) This support is automatically available to client applications.

Da perspectiva do desenvolvedor de software, existem duas maneiras de usar UI Automation: para criar o suporte para controles personalizados (usando a API do provedor) e a criação de aplicativos que usam o UI Automation principais para se comunicar com UI elementos (usando a API do cliente). Depending on your focus, you should refer to different parts of the documentation. You can learn more about the concepts and gain practical how-to knowledge in the following sections.

Section

Subject matter

Audience

Fundamentos de Automação de Interface de Usuário (this section)

Broad overviews of the concepts.

All.

Provedores de Automação de IU para Código Gerenciado

Overviews and how-to topics to help you use the provider API.

Control developers.

Clientes de Automação de Interface de Usuário para Código Gerenciado

Overviews and how-to topics to help you use the client API.

Client application developers.

Padrões de controle de automação de interface do usuário

Information about how control patterns should be implemented by providers, and what functionality is available to clients.

All.

Padrão de Automação de Texto de Interface de Usuário

Information about how the Text control pattern should be implemented by providers, and what functionality is available to clients.

All.

Tipos de controle de automação de interface do usuário

Information about the properties and control patterns supported by different control types.

All.

The following table lists UI Automation namespaces, the DLLs that contain them, and the audience that uses them.

Namespace

Referenced DLLs

Audience

System.Windows.Automation

UIAutomationClientUIAutomationTypes

UI Automation client developers; used to find AutomationElement objects, register for UI Automation events, and work with UI Automation control patterns.

System.Windows.Automation.Provider

UIAutomationProviderUIAutomationTypes

Developers of UI Automation providers for frameworks other than WPF.

System.Windows.Automation.Text

UIAutomationClientUIAutomationTypes

Developers of UI Automation providers for frameworks other than WPF; used to implement the TextPattern control pattern.

System.Windows.Automation.Peers

PresentationFramework

Developers of UI Automation providers for WPF.

UI Automation Model

UI Automation exposes every piece of the UI to client applications as an AutomationElement. Elements are contained in a tree structure, with the desktop as the root element. Clients can filter the raw view of the tree as a control view or a content view. (Esses modos de exibição padrão da estrutura podem facilmente ser vistos usando o UI Spy aplicativo incluído com esse software development kit (SDK)). Aplicativos também podem criar modos de exibição personalizado.

AutomationElement objects expose common properties of the UI elements they represent. Uma dessas propriedades é o o tipo de controle, que define sua aparência básica e a funcionalidade como uma única entidade reconhecível: Por exemplo, um botão ou caixa de seleção.

In addition, elements expose control patterns that provide properties specific to their control types. Control patterns also expose methods that enable clients to get further information about the element and to provide input.

Observação

There is not a one-to-one correspondence between control types and control patterns.A control pattern may be supported by multiple control types, and a control may support multiple control patterns, each of which exposes different aspects of its behavior.Por exemplo, uma caixa de combinação tem pelo menos dois padrões de controle: um que representa a sua capacidade de expandir e recolher e outra que representa o mecanismo de seleção.For specifics, see Tipos de controle de automação de interface do usuário.

UI Automation also provides information to client applications through events. Ao contrário de WinEvents, UI Automation eventos não se baseiam em um mecanismo de difusão. UI Automationregistrar para notificações de evento específico e pode solicitar que específicas de clientes UI Automation informações padrão de propriedades e o controle passado para seus manipuladores de eventos. Além disso, um UI Automation evento contém uma referência para o elemento que disparou a ele. Provedores podem melhorar o desempenho levantando eventos seletivamente, dependendo se a todos os clientes estão escutando.

Consulte também

Conceitos

Visão geral da árvore de automação de interface do usuário

Visão Geral de Padrões de Controle de Automação de Interface de Usuário

UI Automation Properties Overview

Visão geral sobre eventos de automação de interface do usuário

Visão geral de segurança da automação de interface do usuário