public static void Minimize(AutomationElement element) { WindowPattern currentPattern = AutomationPatternHelper.GetWindowPattern(element); if (currentPattern.Current.CanMinimize) { currentPattern.SetWindowVisualState(WindowVisualState.Minimized); } }
public static void AssertReadyForUserInteraction(AutomationElement element) { WindowPattern currentPattern = AutomationPatternHelper.GetWindowPattern(element); WindowInteractionState windowInteractionState = currentPattern.Current.WindowInteractionState; if (windowInteractionState != WindowInteractionState.ReadyForUserInteraction) { throw new Exception(string.Format("Window is not ready for user interaction. State is {0}. ({1})", windowInteractionState.ToString(), element.ToString())); } }
public static string GetWindowState(AutomationElement element) { try { WindowPattern currentPattern = AutomationPatternHelper.GetWindowPattern(element); return(currentPattern.Current.WindowInteractionState.ToString()); } catch (Exception exception) { return("Unable to retrieve window state. " + exception.Message); } }
public static void Restore(AutomationElement element) { AutomationPatternHelper.GetWindowPattern(element).SetWindowVisualState(WindowVisualState.Normal); }