.net UI Automation在不同版本的windows上的AutomationId不一致
我正在研究使用UI自动化框架.net 4.6.1自动化应用程序 使用Visual UI Automation检查应用程序时,请验证我是否能够看到AutomationId属性的值 我已经用C wpf编写了一个小的自动化脚本 当我在Windows7上执行自动化脚本时,一切正常 当我在windows 10上尝试时,所有AutomationId值都是空字符串 示例代码:.net UI Automation在不同版本的windows上的AutomationId不一致,.net,windows,automation,ui-automation,uia,.net,Windows,Automation,Ui Automation,Uia,我正在研究使用UI自动化框架.net 4.6.1自动化应用程序 使用Visual UI Automation检查应用程序时,请验证我是否能够看到AutomationId属性的值 我已经用C wpf编写了一个小的自动化脚本 当我在Windows7上执行自动化脚本时,一切正常 当我在windows 10上尝试时,所有AutomationId值都是空字符串 示例代码: AutomationElement.RootElement.FindFirst ( TreeScope.Descendants,
AutomationElement.RootElement.FindFirst (
TreeScope.Descendants,
new PropertyCondition(AutomationElement.AutomationIdProperty, myAutomationId)
);
此示例返回null,因为它找不到具有myAutomationId值的元素。当我研究AutomationElement.RootElement的所有子元素时,我发现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();
等等