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

后端 未结 3 1306
遇见更好的自我
遇见更好的自我 2020-12-16 14:30
AutomationElement child = walker.GetFirstChild(el);

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

3条回答
  •  没有蜡笔的小新
    2020-12-16 15:30

    try with:

    AutomationElement child = walker.GetFirstChild(el);
    System.Windows.Point p = child.GetClickablePoint();
    Mouse.Move((int)p.X, (int)p.Y);
    Mouse.Click(MouseButton.Left);
    

    Links:
    AutomationElement.GetClickablePoint Method
    Simulate mouse Enter/Move/Leave on WPF control without real mouse usage

    Edit for comment

    See this links:

    Mouse.cs
    NativeMethods.cs
    Introduction to TestApi – Part 1: Input Injection APIs

提交回复
热议问题