问题描述
我无法初始化 AutomationElement.
I can't initialize the AutomationElement.
AutomationElement element = AutomationElement.FromHandle(process.MainWindowHandle);
它突出显示 AutomationElement 它说的错误是 http://i.stack.imgur.com/wNCvq.png
It highlights the AutomationElement The error it says is http://i.stack.imgur.com/wNCvq.png
推荐答案
需要添加相关程序集并添加 using 语句才能使用该类.在这种情况下,您需要 UIAutomationClient.dll
程序集和 using 语句:using System.Windows.Automation.AutomationElement
在您的类的顶部.
You need to add the relevant assembly and add a using statement to use the class. In this case you need the UIAutomationClient.dll
assembly and the using statement: using System.Windows.Automation.AutomationElement
at the top of your class.
有关详细信息,请访问 MSDN 页面:https://msdn.microsoft.com/en-us/library/system.windows.automation.automationelement%28v=vs.110%29.aspx
For more info, visit the MSDN page: https://msdn.microsoft.com/en-us/library/system.windows.automation.automationelement%28v=vs.110%29.aspx
这篇关于如何在 c# 中包含 AutomationElement?我需要补充什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!