AutomationElement.AutomationIdProperty 필드

정의

요소를 식별하는 데 사용되는 AutomationId 속성을 식별합니다.

public: static initonly System::Windows::Automation::AutomationProperty ^ AutomationIdProperty;
public static readonly System.Windows.Automation.AutomationProperty AutomationIdProperty;
 staticval mutable AutomationIdProperty : System.Windows.Automation.AutomationProperty
Public Shared ReadOnly AutomationIdProperty As AutomationProperty 

필드 값

예제

다음 예제에서는 속성의 현재 값을 검색 합니다. 요소 하나를 제공 하지 않는 경우 기본값 반환 됩니다.

string autoId =
    autoElement.GetCurrentPropertyValue(AutomationElement.AutomationIdProperty) as string;
Dim autoId As String = _
    CStr(autoElement.GetCurrentPropertyValue(AutomationElement.AutomationIdProperty))

다음 예제에서는 속성의 현재 값을 검색 하지만 요소 자체의 속성에 대 한 값을 제공 하지 않는 경우 지정 NotSupported 대신 기본값을 반환 하는 것입니다.

string autoIdString;
object autoIdNoDefault =
    autoElement.GetCurrentPropertyValue(AutomationElement.AutomationIdProperty, true);
if (autoIdNoDefault == AutomationElement.NotSupported)
{
    // TODO Handle the case where you do not wish to proceed using the default value.
}
else
{
    autoIdString = autoIdNoDefault as string;
}
Dim autoIdString As String
Dim autoIdNoDefault As Object = autoElement.GetCurrentPropertyValue(AutomationElement.AutomationIdProperty, True)
If autoIdNoDefault Is AutomationElement.NotSupported Then
    ' TODO Handle the case where you do not wish to proceed using the default value.
Else
    autoIdString = CStr(autoIdNoDefault)
End If

설명

이 식별자는 UI 자동화 클라이언트 애플리케이션에서 사용 됩니다. UI 자동화 공급자에서 해당 식별자를 사용 해야 AutomationElementIdentifiers합니다.

이 속성을 검색할 수도 있습니다는 Current 또는 Cached 속성입니다.

반환 형식이 속성의 값은 String합니다. 속성의 기본값은 빈 문자열입니다.

사용 가능한 경우는 AutomationIdProperty 요소의 될 항상 현지 언어에 관계 없이 애플리케이션의 모든 인스턴스에서 동일 해야 합니다. 전체 데스크톱 형제 요소 중에서 고유 하지만 반드시 고유 하지 않은 값을 해야 합니다. 예를 들어, 애플리케이션의 여러 인스턴스 또는 Microsoft Windows 탐색기에서 폴더 뷰를 여러 요소가 같은 AutomationIdProperty, 인스턴스나 등입니다.

지원 하지만 AutomationId 것이 좋습니다 더 나은 테스트 용이성에 대 한이 속성은 필수입니다. 것은 지원 되는 경우에 AutomationId UI 언어에 관계 없이 실행 되는 스크립트를 테스트 자동화에 유용 합니다. 클라이언트는 어떠한가 정도 하지 해야와 관련 하 여는 AutomationId다른 애플리케이션에 의해 노출 되 합니다. AutomationId 애플리케이션의 빌드 또는 서로 다른 릴리스 안정적인 것으로 보장 되지 않습니다.

UI(사용자 인터페이스) 요소의 인스턴스는 해당 속성으로 데스크톱 RuntimeIdProperty 에서 고유하게 식별됩니다.

참고

AutomationIdProperty는 최상위 애플리케이션 창, ID 또는 x:Uid가 없는 WPF(Windows Presentation Foundation) 컨트롤에서 파생된 UI 자동화 요소, 컨트롤 ID가 없는 Win32 컨트롤에서 파생된 UI 자동화 요소를 제외하고 컨트롤 뷰의 모든 UI 자동화 요소에서 지원됩니다.

적용 대상

추가 정보