AutomationElement child = walker.GetFirstChild(el);

使用Windows自动化如何模拟左击Child?

最佳答案

尝试:

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

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

编辑评论

看到此链接:

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

关于c# - 给定一个自动化元素,我该如何模拟单击鼠标左键,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10105396/

10-13 06:23