public static AutomationElement FromPoint(Point pt) { IntPtr handle = NativeMethods.WindowAtPosition((int)pt.X, (int)pt.Y); if (handle == IntPtr.Zero) { return(RootElement); } AutomationElement startElement = null; try { startElement = FromHandle(handle); } catch (ElementNotAvailableException) { return(RootElement); } if (startElement == RootElement) { return(RootElement); } //Keep searching the descendant element which are not native window var sourceElement = startElement.SourceElement. GetDescendantFromPoint(pt.X, pt.Y); return(SourceManager.GetOrCreateAutomationElement(sourceElement)); }