private AutomationElement GetWindowUiaElement(CmdApp app) { IntPtr handle = app.GetWindowHandle(); AutomationElement windowUiaElement = AutomationElement.FromHandle(handle); return(windowUiaElement); }