private IUIItem Create(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, ActionListener actionListener) { IUIItem item = containerItemFactory.Get(searchCriteria, actionListener); if (item == null) return null; windowItemsMap.Add(item.Location, searchCriteria); return item; }
public virtual IUIItem Create(SearchCriteria searchCriteria, ActionListener actionListener) { if (searchCriteria.IsIndexed) { UIItemCollection collection = CreateAll(searchCriteria, actionListener); return searchCriteria.IndexedItem(collection); } return dictionaryMappedItemFactory.Create(Finder.Descendant(searchCriteria.AutomationCondition), actionListener, searchCriteria.CustomItemType); }
public ResultPage(Window window) { this.window = window; var edits = window.GetMultiple(SearchCriteria.ByControlType(ControlType.Edit)).Cast<TextBox>().ToArray(); resultField = edits.First(edit => edit.Text == "0"); resultScreen = edits.First(edit => edit != resultField); resultButton = window.Get<Button>(SearchCriteria.ByText("=")); okButtonCriteria = SearchCriteria.ByText("OK"); }
public virtual IUIItem Get(SearchCriteria searchCriteria, ActionListener uiItemActionListener) { IUIItem item = Find(searchCriteria); if (item == null || item is UIItemContainer) { //Cannot create dynamic proxy for class which has methods using generics. Also its not required to intercept methods on UIItem containers return item; } return UIItemProxyFactory.Create(item, uiItemActionListener); }
public virtual IUIItem Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, ActionListener actionListener) { logger.DebugFormat("Finding item based on criteria: ({0}) on ({1})", searchCriteria, initializeOption.Identifier); Point location = windowItemsMap.GetItemLocation(searchCriteria); if (location.Equals(RectX.UnlikelyWindowPosition)) { logger.Debug("[PositionBasedSearch] Could not find based on position, finding using search."); return Create(containerItemFactory, searchCriteria, actionListener); } AutomationElement automationElement = AutomationElementX.GetAutomationElementFromPoint(location); if (automationElement != null && searchCriteria.AppliesTo(automationElement)) { IUIItem item = new DictionaryMappedItemFactory().Create(automationElement, actionListener, searchCriteria.CustomItemType); return UIItemProxyFactory.Create(item, actionListener); } logger.DebugFormat("[PositionBasedSearch] UIItem {0} changed its position, finding using search.", searchCriteria); return Create(containerItemFactory, searchCriteria, actionListener); }
public virtual Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option, WindowSession windowSession) { var message = "Could not find modal window with SearchCriteria: " + searchCriteria; var modalWindowElement = WaitTillFound(() => Finder.FindWindow(searchCriteria), message); return Create(modalWindowElement, option, windowSession); }
protected ComboBox ComboBox(SearchCriteria criteria) { return _window.Get<ComboBox>(criteria); }
protected override IUIItem Find(SearchCriteria searchCriteria) { return factory.Create(searchCriteria, actionListener); }
public override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option) { var childWindow = Get<Window>(searchCriteria); return childWindow; }
/// <summary> /// Get the modal window launched by this window with NoCache initialize option /// </summary> /// <param name="searchCriteria">Search Criteria to use to find a window</param> /// <returns></returns> public virtual Window ModalWindow(SearchCriteria searchCriteria) { return ModalWindow(searchCriteria, InitializeOption.NoCache); }
//TODO: Position based find should understand MdiChild /// <summary> /// Returns a UIItemContainer using which other sub-ui items can be retrieved. /// Since there is no single standard identification for MdiChild windows, hence it is has been left open for user. /// </summary> /// <param name="searchCriteria"></param> /// <returns></returns> public virtual UIItemContainer MdiChild(SearchCriteria searchCriteria) { var finder = new AutomationElementFinder(automationElement); AutomationElement element = finder.Descendant(searchCriteria.AutomationCondition); return element == null ? null : new UIItemContainer(element, this, InitializeOption.NoCache, WindowSession); }
protected TextBox TextBox(SearchCriteria criteria) { return _window.Get<TextBox>(criteria); }
protected Tab Tab(SearchCriteria criteria) { return _window.Get<Tab>(criteria); }
protected MenuBar MenuBar(SearchCriteria criteria) { return _window.Get<MenuBar>(criteria); }
protected ListItem ListItem(SearchCriteria criteria) { return _window.Get<ListItem>(criteria); }
protected ListBox ListBox(SearchCriteria criteria) { return _window.Get<ListBox>(criteria); }
protected Label Label(SearchCriteria criteria) { return _window.Get<Label>(criteria); }
public override void Apply(SearchCriteria searchCriteria) { searchCriteria.AndAutomationId(name); }
/// <summary> /// Get a child menu based on any search criteria. Use SubMenu(string) for searching based on visible text /// </summary> /// <param name="searchCriteria">Search criteria for the child menu</param> /// <returns></returns> public virtual Menu SubMenu(SearchCriteria searchCriteria) { return ChildMenus.Find(searchCriteria); }
protected UIItem UIItem(SearchCriteria criteria) { return _window.Get<UIItem>(criteria); }
/// <summary> /// Get the modal window launched by this window. /// </summary> /// <param name="searchCriteria">Search Criteria to use to find a window</param> /// <param name="option">Newly created window would be initialized using this option</param> /// <returns></returns> public abstract Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option);
public override void Apply(SearchCriteria searchCriteria) { searchCriteria.AndByText(name); }
public UIItemInterceptor(SearchCriteria searchCriteria, Window window,IReport sessionReport) { this.searchCriteria = searchCriteria; this.window = window; this.sessionReport = sessionReport; }
public virtual AutomationElement FindWindow(SearchCriteria searchCriteria, int processId) { Condition condition = searchCriteria.AutomationConditionWith(new PropertyCondition(AutomationElement.ProcessIdProperty, processId)); return automationElement.FindFirst(TreeScope.Children, condition); }
public override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option) { return null; }
public virtual AutomationElement FindWindow(SearchCriteria searchCriteria) { return automationElement.FindFirst(TreeScope.Children, searchCriteria.AutomationCondition); }
public override UIItemCollection GetAll(SearchCriteria searchCriteria) { return factory.CreateAll(searchCriteria, actionListener); }
public override UIItemCollection GetAll(SearchCriteria searchCriteria) { return children.GetAll(searchCriteria, actionListener); }
protected override IUIItem Find(SearchCriteria searchCriteria) { return children.Get(searchCriteria, actionListener); }
protected Button Button(SearchCriteria criteria) { return _window.Get<Button>(criteria); }