在C#中使用AutomationElement

时间:2016-01-21 05:07:49

标签: c# user-interface dll reference ui-automation

我试图在C#中使用AutomationElement对象进行UIAutomation,但它没有得到识别。我猜它不是标准库的一部分,因为我得到了Visual Studio的提示,说我可能缺少一个引用,但是我需要添加哪个引用才能使用AutomationElement ?

我已经尝试过UIAutomationClient,但即使根据Microsoft documentation这应该包含AutomationElement,它也无法工作。

希望有人可以提供帮助

1 个答案:

答案 0 :(得分:2)

在您发布的链接中,您拥有所有信息,您需要添加对UIAutomationClient的引用(右键单击项目引用)并将命名空间System.Windows.Automation添加到您的源

add reference add namespace