9
我想知道,在.NET,如果(管理)微软UI自动化框架提供了一些方法来实例化给出一个窗口的AutomationId
值AutomationElement
型,抑制这种方式需要搜索窗口通过窗口句柄或其他类型的标识符。可以通过AutomationId值实例化AutomationElement类型吗?
写在VB.NET理解我的目的伪例如:
Dim automationId As Integer = 1504
Dim element As AutomationElement = AutomationElement.FromAutomationId(automationId)
我能找到的最好的是[this](https://msdn.microsoft.com/en-us/library/aa349646(v = vs.110).aspx)。否则,我会说构造你自己的类(如果可能的话)和阴影/覆盖'AutomationId'属性。然后,无论何时执行setter,您都将“window”/“control”存储在全局共享列表/字典中。 –
@Visual Vincent Thankyou,我看到的“问题”是使用该解决方案,它是一种搜索方法,还需要一个AutomationElement来搜索其元素,一种昂贵的查找算法。我想知道是否存在一种更“直接”的方式来避免这一切。 – ElektroStudios