Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Given an Automation Element how do i simulate a single left click on it

Tags:

c#

automation

AutomationElement child = walker.GetFirstChild(el);

using windows automation How do i simulator a left single click on Child ?

like image 777
Stacker Avatar asked Apr 11 '12 11:04

Stacker


1 Answers

Rather than sending mouse events, you can Invoke it through the InvokePattern like so:

public void InvokeAutomationElement(AutomationElement automationElement)
{
    var invokePattern = automationElement.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
    invokePattern.Invoke();
}
like image 193
Levi Avatar answered Oct 12 '22 14:10

Levi