public static void MouseClick(AutomationElement element) { element.ScrollToIfPossible(); element.SetFocus(); var clickablePoint = element.GetClickablePoint(); Cursor.Position = new System.Drawing.Point((int)clickablePoint.X, (int)clickablePoint.Y); mouse_event(MOUSEEVENTLF_LEFTDOWN, 0, 0, 0, 0); mouse_event(MOUSEEVENTLF_LEFTUP, 0, 0, 0, 0); }
private static void Click(AutomationElement element, Func<Point> GetPoint) { element.ScrollToIfPossible(); element.TryToFocus(); var point = GetPoint(); Cursor.Position = new System.Drawing.Point((int) point.X, (int) point.Y); Down(); Up(); }