[英]UI Automation's AutomationId inconsistency on different versions of windows
我正在使用UI自動化框架(.net 4.6.1)自動化應用程序。
使用Visual UI Automation Verify
應用程序時,我可以看到AutomationId
屬性的值。
我已經用C#(wpf)編寫了一個小型自動化腳本
當我在Windows 7上執行自動化腳本時,一切正常。
在Windows 10上嘗試時,所有AutomationId值均為空字符串。
樣例代碼:
AutomationElement.RootElement.FindFirst (
TreeScope.Descendants,
new PropertyCondition(AutomationElement.AutomationIdProperty, myAutomationId)
);
此示例返回null,因為當我瀏覽AutomationElement.RootElement
所有子級時,它找不到具有myAutomationId
值的元素,我發現AutomationId值是空的(這與我在Visual UI Automation Verify
上看到的不同,並且與當在Windows 7上運行)
我對AutomationId
屬性缺少什么? 或關於UI自動化框架如何在Windows 10上運行?
編輯:
我注意到,當我遍歷子元素時,我發現其中的一些元素具有一個AutomationId,其值為NativeWindowHandle的值。為什么?
編輯2:
我嘗試了范圍廣泛的具有多個版本的UI自動化dll,但沒有一個甚至無法在Windows 10上找到該應用程序。
TestStack.White
(在Windows 7上也不起作用)。
可以正常工作的UIA是UIAutomationClient.dll (如果需要,可以添加UIAutomationTypes.dll)
它直接使用自動化接口:
IUIAutomation uiautomation = new CUIAutomation();
等等...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.