示例#1
0
 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;
 }
示例#2
0
 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);
 }
示例#3
0
        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");
        }
示例#4
0
 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);
 }
示例#5
0
        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);
        }
示例#6
0
 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);
 }
示例#7
0
 protected ComboBox ComboBox(SearchCriteria criteria)
 {
     return _window.Get<ComboBox>(criteria);
 }
 protected override IUIItem Find(SearchCriteria searchCriteria)
 {
     return factory.Create(searchCriteria, actionListener);
 }
示例#9
0
 public override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option)
 {
     var childWindow = Get<Window>(searchCriteria);
     return childWindow;
 }
示例#10
0
文件: Window.cs 项目: spider09/White
 /// <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);
 }
示例#11
0
文件: Window.cs 项目: spider09/White
 //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);
 }
示例#12
0
 protected TextBox TextBox(SearchCriteria criteria)
 {
     return _window.Get<TextBox>(criteria);
 }
示例#13
0
 protected Tab Tab(SearchCriteria criteria)
 {
     return _window.Get<Tab>(criteria);
 }
示例#14
0
 protected MenuBar MenuBar(SearchCriteria criteria)
 {
     return _window.Get<MenuBar>(criteria);
 }
示例#15
0
 protected ListItem ListItem(SearchCriteria criteria)
 {
     return _window.Get<ListItem>(criteria);
 }
示例#16
0
 protected ListBox ListBox(SearchCriteria criteria)
 {
     return _window.Get<ListBox>(criteria);
 }
示例#17
0
 protected Label Label(SearchCriteria criteria)
 {
     return _window.Get<Label>(criteria);
 }
示例#18
0
 public override void Apply(SearchCriteria searchCriteria)
 {
     searchCriteria.AndAutomationId(name);
 }
示例#19
0
文件: Menu.cs 项目: EricBlack/White
 /// <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);
 }
示例#20
0
 protected UIItem UIItem(SearchCriteria criteria)
 {
     return _window.Get<UIItem>(criteria);
 }
示例#21
0
文件: Window.cs 项目: spider09/White
 /// <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);
示例#22
0
 public override void Apply(SearchCriteria searchCriteria)
 {
     searchCriteria.AndByText(name);
 }
示例#23
0
 public UIItemInterceptor(SearchCriteria searchCriteria, Window window,IReport sessionReport)
 {
     this.searchCriteria = searchCriteria;
     this.window = window;
     this.sessionReport = sessionReport;
 }
示例#24
0
 public virtual AutomationElement FindWindow(SearchCriteria searchCriteria, int processId)
 {
     Condition condition = searchCriteria.AutomationConditionWith(new PropertyCondition(AutomationElement.ProcessIdProperty, processId));
     return automationElement.FindFirst(TreeScope.Children, condition);
 }
示例#25
0
 public override Window ModalWindow(SearchCriteria searchCriteria, InitializeOption option)
 {
     return null;
 }
示例#26
0
 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);
 }
示例#30
0
 protected Button Button(SearchCriteria criteria)
 {
     return _window.Get<Button>(criteria);
 }