Ejemplo n.º 1
0
 protected ScrollBar(AutomationElement automationElement, ActionListener actionListener, ScrollBarButtonAutomationIds automationIds)
     : base(automationElement, actionListener)
 {
     this.automationIds = automationIds;
     var finder = new AutomationElementFinder(automationElement);
     primaryUIItemFactory = new PrimaryUIItemFactory(finder);
 }
Ejemplo n.º 2
0
 public ScrollBars(AutomationElement automationElement, ActionListener actionListener,
     ScrollBarButtonAutomationIds hScrollBarButtonAutomationIds, ScrollBarButtonAutomationIds vScrollBarButtonAutomationIds)
 {
     this.actionListener = actionListener;
     this.hScrollBarButtonAutomationIds = hScrollBarButtonAutomationIds;
     this.vScrollBarButtonAutomationIds = vScrollBarButtonAutomationIds;
     finder = new AutomationElementFinder(automationElement);
 }
        private static SuggestionList Find(ActionListener actionListener)
        {
            AutomationElement dropDown =
                new AutomationElementFinder(AutomationElement.RootElement).Child(AutomationSearchCondition.ByClassName("Auto-Suggest Dropdown"));
            if (dropDown == null) return null;

            AutomationElement listViewElement =
                new AutomationElementFinder(dropDown).Child(AutomationSearchCondition.ByControlType(ControlType.DataGrid));
            if (listViewElement == null) return null;
            return new ListView(listViewElement, actionListener);
        }
Ejemplo n.º 4
0
 public TableScrollBars(AutomationElementFinder finder, ActionListener actionListener, TableVerticalScrollOffset tableVerticalScrollOffset)
 {
     AutomationElement verticalScrollElement = finder.Child(AutomationSearchCondition.ByControlType(ControlType.Pane).OfName(UIItemIdAppXmlConfiguration.Instance.TableVerticalScrollBar));
     verticalScrollBar = (verticalScrollElement == null)
                             ? (IVScrollBar) new NullVScrollBar()
                             : new TableVerticalScrollBar(verticalScrollElement, actionListener, tableVerticalScrollOffset);
     AutomationElement horizontalScrollElement = finder.Child(AutomationSearchCondition.ByControlType(ControlType.Pane).OfName(UIItemIdAppXmlConfiguration.Instance.TableHorizontalScrollBar));
     horizontalScrollBar = (horizontalScrollElement == null)
                               ? (IHScrollBar) new NullHScrollBar()
                               : new TableHorizontalScrollBar(horizontalScrollElement, actionListener);
 }
 public virtual AutomationElement Find(int returnLevel, AutomationElement startElement)
 {
     AutomationElement currentElement = startElement;
     AutomationElement automationElementAtReturnLevel = null;
     for (int i = 0; i < searchConditions.Length; i++)
     {
         var currentFinder = new AutomationElementFinder(currentElement);
         AutomationElement childElement = currentFinder.Child(searchConditions[i]);
         if (childElement == null) return null;
         currentElement = childElement;
         if (i == returnLevel) automationElementAtReturnLevel = childElement;
     }
     return automationElementAtReturnLevel;
 }
        public virtual List<AutomationElement> FindAll(AutomationElement startElement)
        {
            AutomationElement currentElement = startElement;
            for (int i = 0; i < searchConditions.Length; i++)
            {
                var currentFinder = new AutomationElementFinder(currentElement);
                if (i == searchConditions.Length - 1) return currentFinder.Children(searchConditions[i]);

                AutomationElement childElement = currentFinder.Child(searchConditions[i]);
                currentElement = childElement;
                if (childElement == null)
                    return null;
            }
            throw new WhiteAssertionException("Something wrong in logic here");
        }
Ejemplo n.º 7
0
 public virtual Window FindModalWindow(string title, Process process, InitializeOption option, AutomationElement parentWindowElement,
     WindowSession windowSession)
 {
     var windowFinder = new AutomationElementFinder(parentWindowElement);
     try
     {
         AutomationElement modalWindowElement = WaitTillFound(delegate
                                                                  {
                                                                      AutomationElement windowElement = windowFinder.FindWindow(title, process.Id) ??
                                                                                                        finder.FindWindow(title, process.Id);
                                                                      return windowElement;
                                                                  }, "Could not find modal window with title: " + title);
         return Create(modalWindowElement, option, windowSession);
     }
     catch (UIActionException e)
     {
         WhiteLogger.Instance.Debug(e.ToString());
         return null;
     }
 }
        public virtual AutomationElement Find(int returnLevel, AutomationElement startElement)
        {
            AutomationElement currentElement = startElement;
            AutomationElement automationElementAtReturnLevel = null;

            for (int i = 0; i < searchConditions.Length; i++)
            {
                var currentFinder = new AutomationElementFinder(currentElement);
                AutomationElement childElement = currentFinder.Child(searchConditions[i]);
                if (childElement == null)
                {
                    return(null);
                }
                currentElement = childElement;
                if (i == returnLevel)
                {
                    automationElementAtReturnLevel = childElement;
                }
            }
            return(automationElementAtReturnLevel);
        }
        public virtual List <AutomationElement> FindAll(AutomationElement startElement)
        {
            AutomationElement currentElement = startElement;

            for (int i = 0; i < searchConditions.Length; i++)
            {
                var currentFinder = new AutomationElementFinder(currentElement);
                if (i == searchConditions.Length - 1)
                {
                    return(currentFinder.Children(searchConditions[i]));
                }

                AutomationElement childElement = currentFinder.Child(searchConditions[i]);
                currentElement = childElement;
                if (childElement == null)
                {
                    return(null);
                }
            }
            throw new WhiteAssertionException("Something wrong in logic here");
        }
Ejemplo n.º 10
0
 protected TreeNode(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
     finder = new AutomationElementFinder(automationElement);
 }
Ejemplo n.º 11
0
 public Table(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
     finder = new AutomationElementFinder(automationElement);
     tableRowFactory = new TableRowFactory(finder);
 }
Ejemplo n.º 12
0
 public TitleBar(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
     automationElementFinder = new AutomationElementFinder(automationElement);
 }
Ejemplo n.º 13
0
 public virtual Window FindModalWindow(SearchCriteria searchCriteria, InitializeOption option, AutomationElement parentWindowElement, WindowSession windowSession)
 {
     var windowFinder = new AutomationElementFinder(parentWindowElement);
     try
     {
         AutomationElement modalWindowElement = WaitTillFound(() =>
         {
             AutomationElement windowElement = windowFinder.FindWindow(searchCriteria) ??
                 Finder.FindWindow(searchCriteria);
             return windowElement;
         }, "Could not find modal window with SearchCriteria: " + searchCriteria);
         return Create(modalWindowElement, option, windowSession);
     }
     catch (UIActionException e)
     {
         logger.Debug(e.ToString());
         return null;
     }
 }
Ejemplo n.º 14
0
        private AutomationElement FindWindowElement(Process process, Predicate<string> match)
        {
            var elements = FindAllWindowElements(process);
            return elements.Find(automationElement =>
            {
                if (match.Invoke(automationElement.Current.Name)) return true;

                AutomationElement titleBarElement =
                    new AutomationElementFinder(automationElement).Child(AutomationSearchCondition.ByControlType(ControlType.TitleBar));
                if (titleBarElement == null) return false;
                return match.Invoke(titleBarElement.Current.Name);
            });
        }
Ejemplo n.º 15
0
 private Desktop(AutomationElement automationElement, ActionListener actionListener, InitializeOption initializeOption,
                 WindowSession windowSession)
     : base(automationElement, actionListener, initializeOption, windowSession)
 {
     finder = new AutomationElementFinder(automationElement);
 }
Ejemplo n.º 16
0
 public ListControl(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
     finder = new AutomationElementFinder(automationElement);
 }
Ejemplo n.º 17
0
 public ListViewFactory(AutomationElementFinder automationElementFinder, ActionListener actionListener)
 {
     this.automationElementFinder = automationElementFinder;
     this.actionListener = actionListener;
 }
Ejemplo n.º 18
0
 private WindowFactory(AutomationElementFinder automationElementFinder)
     : base(automationElementFinder)
 {
 }
Ejemplo n.º 19
0
 public PrimaryUIItemFactory(AutomationElementFinder finder)
     : base(finder)
 {
 }
Ejemplo n.º 20
0
 public TableRowFactory(AutomationElementFinder automationElementFinder)
 {
     this.automationElementFinder = automationElementFinder;
 }
Ejemplo n.º 21
0
 internal Tree(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
     finder = new AutomationElementFinder(automationElement);
 }
Ejemplo n.º 22
0
 public ListViewHeader(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
     automationElementFinder = new AutomationElementFinder(automationElement);
 }
Ejemplo n.º 23
0
 public Spinner(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
     finder = new AutomationElementFinder(automationElement);
 }
Ejemplo n.º 24
0
 private void FindDescendantWindowElements(AutomationElementFinder windowFinder, Process process, BricksCollection<AutomationElement> windowElements)
 {
     List<AutomationElement> children =
         windowFinder.Children(AutomationSearchCondition.ByControlType(ControlType.Window).WithProcessId(process.Id));
     windowElements.AddRange(children);
     foreach (AutomationElement automationElement in children)
         FindDescendantWindowElements(new AutomationElementFinder(automationElement), process, windowElements);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Recursively gets all the descendant windows.
 /// </summary>
 /// <returns></returns>
 public virtual List<Window> ModalWindows()
 {
     var modalWindows = new List<Window>();
     var finder = new AutomationElementFinder(automationElement);
     var descendants =
         finder.Descendants(AutomationSearchCondition.ByControlType(ControlType.Window));
     foreach (AutomationElement descendant in descendants)
         modalWindows.Add(ChildWindowFactory.Create(descendant, InitializeOption.NoCache,
                                                    windowSession.ModalWindowSession(InitializeOption.NoCache)));
     return modalWindows;
 }
Ejemplo n.º 26
0
        private AutomationElement FindWindowElement(Process process, Predicate<string> match)
        {
            BricksCollection<AutomationElement> elements = FindAllWindowElements(process);
            return elements.Find(delegate(AutomationElement obj)
                                     {
                                         if (match.Invoke(obj.Current.Name)) return true;

                                         AutomationElement titleBarElement =
                                             new AutomationElementFinder(obj).Child(AutomationSearchCondition.ByControlType(ControlType.TitleBar));
                                         if (titleBarElement == null) return false;
                                         return match.Invoke(titleBarElement.Current.Name);
                                     });
        }
Ejemplo n.º 27
0
 public ListViewRow(AutomationElement automationElement, ActionListener actionListener, ListViewHeader header)
     : base(automationElement, actionListener)
 {
     this.header = header;
     finder = new AutomationElementFinder(automationElement);
 }
 public PropertyGridElementFinder(AutomationElement automationElement)
 {
     finder = new AutomationElementFinder(automationElement);
 }
Ejemplo n.º 29
0
 //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 ChildWindowFactory(AutomationElementFinder finder)
 {
     this.finder = finder;
 }
Ejemplo n.º 31
0
 public WPFListItem(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
     finder = new AutomationElementFinder(automationElement);
 }