AutomationElement.AutomationElementInformation.AutomationId 屬性

定義

取得字串,其中包含專案的 UI 自動化識別碼 (識別碼) 。

public:
 property System::String ^ AutomationId { System::String ^ get(); };
public string AutomationId { get; }
member this.AutomationId : string
Public ReadOnly Property AutomationId As String

屬性值

在其容器內同層級之間唯一之專案的識別碼。

備註

當專案可供使用時, AutomationIdProperty 不論本機語言為何,應用程式的任何實例預期一律相同。 值在同層級元素之間應該是唯一的,但在整個桌面上不一定是唯一的。 例如,應用程式多個實例或 Microsoft Windows 檔案總管中的多個資料夾檢視可能包含具有相同 AutomationIdProperty 的元素,例如 「SystemMenuBar」。

雖然一律建議支援 , AutomationId 以取得更佳的可測試性,但這不是必要屬性。 支援的位置, AutomationId 適用于建立不論 UI 語言為何執行的測試自動化腳本。 用戶端不應假設 AutomationId 其他應用程式所公開的 。 AutomationId不一定保證在應用程式的不同版本或組建之間保持穩定。

如需詳細資訊,請參閱AutomationIdProperty

適用於