Version

GetAutomationId Method

Returns a string containing the UI Automation identifier (ID) for the automation element.
Syntax
'Declaration
 
Protected Overridable Function GetAutomationId() As String
protected virtual string GetAutomationId()
Remarks

When it is available, the AutomationId of an element must be the same in any instance of the application, regardless of the local language. The value should be unique among sibling elements, but not necessarily unique across the entire desktop. For example, multiple instances of an application, or multiple folder views in Microsoft Windows Explorer, may contain elements with the same AutomationId property, such as "SystemMenuBar".

While support for AutomationId is always recommended for better testability, this property is not mandatory. Where it is supported, AutomationId is useful for creating a test automation script that runs regardless of the UI language. Clients should make no assumptions regarding the AutomationIds exposed by other applications. AutomationId is not guaranteed to be stable across different releases or builds of an application.

The AutomationId property has a variant type of VT_BSTR; the default value is an empty string.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also