I can't initialize the AutomationElement.
AutomationElement element = AutomationElement.FromHandle(process.MainWindowHandle);
It highlights the AutomationElement The error it says is http://i.stack.imgur.com/wNCvq.png
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.
For more info, visit the MSDN page: https://msdn.microsoft.com/en-us/library/system.windows.automation.automationelement%28v=vs.110%29.aspx
In the project explorer Add references : UIAutomationClient AND UIAutomationTypes
The UIAutomationClient.dll
need to be referenced in the project. The DLL file is located at C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With