private static bool TryPoint(ref Point pt, AutomationElement el, out AutomationElement hitEl) { // If the element is obscured by another window or hidden somehow when we try to hit test we don't get back // the same element. We want to make sure if someone clicks they click on what they expected to click on. hitEl = AutomationElement.FromPoint(pt); return(hitEl == el); }