public static void ComboSelectItem(this AutomationElement combo, Expression <Func <AutomationElement, bool> > itemCondition) { combo.Pattern <ExpandCollapsePattern>().Expand(); var item = combo.Child(itemCondition); item.Pattern <SelectionItemPattern>().Select(); combo.Pattern <ExpandCollapsePattern>().Collapse(); }
public void SortColumn(string token, OrderType orderType) { var columnHeader = ResultColumns.Child(a => a.Current.ControlType == ControlType.HeaderItem && a.Current.Name == token); columnHeader.ButtonInvoke(); while (columnHeader.Current.ItemStatus != orderType.ToString()) { columnHeader.ButtonInvoke(); } WaitSearch(); }
public static AutomationElement MenuItemFind(AutomationElement menu, params string[] menuNames) { if (menuNames == null || menuNames.Length == 0) { throw new ArgumentNullException("menuNames"); } var menuItem = menu.Child(mi => mi.Current.Name == menuNames[0]); var window = menu.Parent(mi => mi.Current.ControlType == ControlType.Window); for (int i = 1; i < menuNames.Length; i++) { menuItem.Pattern <ExpandCollapsePattern>().Expand(); AutomationElement result = null; window.Wait(() => { result = menuItem.TryChild(mi => mi.Current.Name == menuNames[i]); if (result != null) { return(true); } if (window != null) { result = window.TryChild(a => a.Current.ControlType == ControlType.Window); if (result != null) { return(true); } } return(false); }, actionDescription: () => "Popup window or MenuItem after expanding MenuItem {0}".FormatWith(menuNames[i - 1])); if (result.Current.ControlType == ControlType.Window) { window = result; menuItem = window.TryChild(mi => mi.Current.Name == menuNames[i]); } else { window = null; menuItem = result; } } return(menuItem); }
public ValueLineBoxProxy(AutomationElement element) : base(element.AssertClassName("ValueLineBox")) { ValueLine = new ValueLineProxy(element.Child(e => e.Current.ClassName == "ValueLine"), null); }
public MainWindowProxy(AutomationElement element) : base(element) { OmniBox = new OmniBoxProxy(element.Descendant(e => e.Current.AutomationId == "autoCompleteTb")); MenuBar = element.Child(c => c.Current.ControlType == ControlType.Menu); }