Exemplo n.º 1
0
 private ToolTip GetToolTip(UIItem uiItem, IActionListener actionListener)
 {
     mouse.Click(uiItem.Bounds.Center());
     actionListener.ActionPerformed(Action.WindowMessage);
     Thread.Sleep(CoreAppXmlConfiguration.Instance.TooltipWaitTime);
     return ToolTip.GetFrom(uiItem.Bounds.Center());
 }
 public void AddImageDragDropListener(IActionListener listener)
 {
     pictureBoxSource.DragDrop += (sender, e) =>
     {
         if (e.Data.GetDataPresent(DataFormats.FileDrop))
         {
             var data = e.Data.GetData(DataFormats.FileDrop) as string[];
             if (data != null && data.Length > 0)
             {
                 listener.ActionPerformed(sender, new MyDragDropEventArgs<string[]>(data));
             }
         }
     };
     pictureBoxTarget.DragDrop += (sender, e) =>
     {
         if (e.Data.GetDataPresent(DataFormats.FileDrop))
         {
             var data = e.Data.GetData(DataFormats.FileDrop) as string[];
             if (data != null && data.Length > 0)
             {
                 listener.ActionPerformed(sender, new MyDragDropEventArgs<string[]>(data));
             }
         }
     };
 }
Exemplo n.º 3
0
 protected ScrollBar(AutomationElement automationElement, IActionListener actionListener, ScrollBarButtonAutomationIds automationIds)
     : base(automationElement, actionListener)
 {
     this.automationIds = automationIds;
     var finder = new AutomationElementFinder(automationElement);
     primaryUIItemFactory = new PrimaryUIItemFactory(finder);
 }
Exemplo n.º 4
0
 public ScrollBars(AutomationElement automationElement, IActionListener actionListener,
     ScrollBarButtonAutomationIds hScrollBarButtonAutomationIds, ScrollBarButtonAutomationIds vScrollBarButtonAutomationIds)
 {
     this.actionListener = actionListener;
     this.hScrollBarButtonAutomationIds = hScrollBarButtonAutomationIds;
     this.vScrollBarButtonAutomationIds = vScrollBarButtonAutomationIds;
     finder = new AutomationElementFinder(automationElement);
 }
Exemplo n.º 5
0
 internal static IScrollBars CreateBars(AutomationElement parentElement, IActionListener listener)
 {
     var frameworkId = parentElement.Current.FrameworkId;
     if (frameworkId == WindowsFramework.Wpf.FrameworkId())
         return new WPFScrollBars(parentElement, listener);
     if (frameworkId == WindowsFramework.Silverlight.FrameworkId())
         return new ScrollBars(parentElement, listener, new SilverlightHScrollBarButtonAutomationIds(), new SilverlightVScrollBarButtonAutomationIds());
     return new ScrollBars(parentElement, listener, new DefaultScrollBarButtonAutomationIds(), new DefaultScrollBarButtonAutomationIds());
 }
Exemplo n.º 6
0
 public virtual IUIItem Create(SearchCriteria searchCriteria, IActionListener actionListener)
 {
     if (searchCriteria.IsIndexed)
     {
         UIItemCollection collection = CreateAll(searchCriteria, actionListener);
         return searchCriteria.IndexedItem(collection);
     }
     return dictionaryMappedItemFactory.Create(Finder.Descendant(searchCriteria.AutomationCondition), actionListener,
                                               searchCriteria.CustomItemType);
 }
Exemplo n.º 7
0
 public virtual IUIItem Get(SearchCriteria searchCriteria, IActionListener 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);
 }
Exemplo n.º 8
0
        private static ISuggestionList Find(IActionListener 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);
        }
Exemplo n.º 9
0
 public TableScrollBars(AutomationElementFinder finder, IActionListener actionListener, ITableVerticalScrollOffset 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);
 }
Exemplo n.º 10
0
 private static ISuggestionList WaitTill(IActionListener actionListener, string failureMessage, Predicate<ISuggestionList> shouldRetry)
 {
     try
     {
         return Retry.For(() => Find(actionListener), shouldRetry, CoreAppXmlConfiguration.Instance.SuggestionListTimeout());
     }
     catch (Exception ex)
     {
         throw new UIActionException(failureMessage + Constants.BusyMessage, ex);
     }
 }
Exemplo n.º 11
0
 public virtual void DoubleClickOutsideToolTip(UIItem uiItem, IActionListener actionListener)
 {
     actionListener.ActionPerforming(uiItem);
     ToolTip toolTip = GetToolTip(uiItem, actionListener);
     if (toolTip == null)
         mouse.DoubleClick(uiItem.Bounds.Center(), actionListener);
     else
     {
         logger.Debug("Found tooltip DoubleClicking outside tooltip bounds");
         mouse.DoubleClick(toolTip.LeftOutside(uiItem.Bounds), actionListener);
     }
 }
Exemplo n.º 12
0
        public virtual UIItemCollection ItemsWithin(Rect bounds, IActionListener actionListener)
        {
            var collection = new UIItemCollection();
            List<AutomationElement> descendants = Finder.Descendants(AutomationSearchCondition.All);
            foreach (AutomationElement automationElement in descendants)
            {
                if (!bounds.Contains(automationElement.Current.BoundingRectangle)) continue;

                var factory = new DictionaryMappedItemFactory();
                collection.Add(factory.Create(automationElement, actionListener));
            }
            return collection;
        }
Exemplo n.º 13
0
 public virtual void RightClickOutsideToolTip(UIItem uiItem, IActionListener actionListener)
 {
     actionListener.ActionPerforming(uiItem);
     ToolTip toolTip = GetToolTip(uiItem, actionListener);
     if (toolTip == null)
     {
         //Because mouse has already been moved
         mouse.Click(MouseButton.Right, actionListener);
     }
     else
     {
         logger.Debug("Found tooltip RightClicking outside tooltip bounds");
         mouse.RightClick(toolTip.LeftOutside(uiItem.Bounds), actionListener);
     }
 }
Exemplo n.º 14
0
        public virtual IUIItem Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, IActionListener 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);
        }
Exemplo n.º 15
0
 public ToolTip(AutomationElement automationElement, IActionListener actionListener)
     : base(automationElement, actionListener)
 {
 }
Exemplo n.º 16
0
 public TreeNodes(AutomationElementFinder finder, IActionListener actionListener)
     : base(finder.Children(AutomationSearchCondition.ByControlType(ControlType.TreeItem)), actionListener)
 {
 }
Exemplo n.º 17
0
 public WPFStatusBar(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Exemplo n.º 18
0
 public ListViewCells(List <AutomationElement> collection, IActionListener actionListener, ListViewHeader header)
     : base(collection, new ListViewCellFactory(), actionListener)
 {
     this.header = header;
 }
Exemplo n.º 19
0
 public Win32ListItem(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Exemplo n.º 20
0
 public HScrollBar(AutomationElement automationElement, IActionListener actionListener,
     ScrollBarButtonAutomationIds automationIds)
     : base(automationElement, actionListener, automationIds)
 {
 }
Exemplo n.º 21
0
 public RadioButton(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Exemplo n.º 22
0
 public void SetAddListener(IActionListener l)
 {
     m_addListener = l;
 }
Exemplo n.º 23
0
        private IUIItem Create(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, IActionListener actionListener)
        {
            IUIItem item = containerItemFactory.Get(searchCriteria, actionListener);

            if (item == null)
            {
                return(null);
            }
            windowItemsMap.Add(item.Location, searchCriteria);
            return(item);
        }
Exemplo n.º 24
0
        public virtual IUIItem Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, IActionListener 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));
        }
Exemplo n.º 25
0
 public WpfTreeViewHScrollBar(AutomationElement parent, IActionListener actionListener)
     : base(parent)
 {
     this.actionListener = actionListener;
 }
Exemplo n.º 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UIItemCollection"/> class.
 /// </summary>
 /// <param name="automationElements">
 /// The automation elements.
 /// </param>
 /// <param name="uiItemFactory">
 /// The UI Item factory.
 /// </param>
 /// <param name="actionListener">
 /// The action listener.
 /// </param>
 public UIItemCollection(IEnumerable automationElements, IUIItemFactory uiItemFactory, IActionListener actionListener)
 {
     foreach (AutomationElement automationElement in automationElements)
     {
         var uiItem = uiItemFactory.Create(automationElement, actionListener);
         if (uiItem != null)
         {
             this.Add(uiItem);
         }
     }
 }
Exemplo n.º 27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UIItemCollection"/> class.
 /// </summary>
 /// <param name="automationElements">
 /// The automation elements.
 /// </param>
 /// <param name="actionListener">
 /// The action listener.
 /// </param>
 public UIItemCollection(IEnumerable automationElements, IActionListener actionListener)
     : this(automationElements, DictionaryMappedItemFactory, actionListener)
 {
 }
Exemplo n.º 28
0
 private Desktop(AutomationElement automationElement, IActionListener actionListener, InitializeOption initializeOption, WindowSession windowSession)
     : base(automationElement, actionListener, initializeOption, windowSession)
 {
     finder = new AutomationElementFinder(automationElement);
 }
 public DateTimePicker(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Exemplo n.º 30
0
 public virtual void PressSpecialKey(KeyboardInput.SpecialKeys key, IActionListener actionListener)
 {
     Send(key, true);
     actionListener.ActionPerformed(Action.WindowMessage);
 }
Exemplo n.º 31
0
 public static ISuggestionList WaitAndFind(IActionListener actionListener)
 {
     return WaitTill(actionListener, "Took too long to find suggestion list", obj => obj == null);
 }
Exemplo n.º 32
0
 internal virtual void HoldKey(KeyboardInput.SpecialKeys key, IActionListener actionListener)
 {
     SendKeyDown((short)key, true);
     heldKeys.Add(key);
     actionListener.ActionPerformed(Action.WindowMessage);
 }
Exemplo n.º 33
0
 public UIItemContainer(AutomationElement automationElement, IActionListener actionListener)
     : this(automationElement, actionListener, InitializeOption.NoCache, new NullWindowSession())
 {
 }
Exemplo n.º 34
0
 public virtual void LeaveKey(KeyboardInput.SpecialKeys key, IActionListener actionListener)
 {
     SendKeyUp((short)key, true);
     heldKeys.Remove(key);
     actionListener.ActionPerformed(Action.WindowMessage);
 }
Exemplo n.º 35
0
 public ToolTip(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Exemplo n.º 36
0
 protected Window(AutomationElement automationElement, IActionListener actionListener, InitializeOption initializeOption, WindowSession windowSession)
     : base(automationElement, actionListener, initializeOption, windowSession)
 {
     InitializeWindow();
     minOpenTime = Task.Factory.StartNew(() => Thread.Sleep(500));
 }
Exemplo n.º 37
0
 public ListItems(List <AutomationElement> collection, IActionListener actionListener) : base(collection, actionListener)
 {
     this.actionListener = actionListener;
 }
Exemplo n.º 38
0
 public WinFormTextBox(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Exemplo n.º 39
0
 public Button(AutomationElement automationElement, IActionListener actionListener)
     : base(automationElement, actionListener)
 {
     toggleableItem = new ToggleableItem(this);
 }
Exemplo n.º 40
0
 public WinFormScrollBars(AutomationElement automationElement, IActionListener actionListener)
     : base(automationElement, actionListener, new DefaultScrollBarButtonAutomationIds(), new DefaultScrollBarButtonAutomationIds())
 {
 }
Exemplo n.º 41
0
 public WpfTreeViewHScrollBar(AutomationElement parent, IActionListener actionListener)
     : base(parent)
 {
     this.actionListener = actionListener;
 }
Exemplo n.º 42
0
 public SelectionItem(AutomationElement automationElement, IActionListener actionListener)
     : base(automationElement, actionListener)
 {
 }
Exemplo n.º 43
0
 public NonCachedContainerItemFactory(PrimaryUIItemFactory factory, IActionListener actionListener)
 {
     this.factory = factory;
     this.actionListener = actionListener;
 }
Exemplo n.º 44
0
 public WPFComboBox(AutomationElement automationElement, IActionListener actionListener)
     : base(automationElement, actionListener)
 {
 }
Exemplo n.º 45
0
 protected Slider(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
     uiItemContainer = new UIItemContainer(automationElement, actionListener, InitializeOption.NoCache, new NullWindowSession());
 }
Exemplo n.º 46
0
 public ListControl(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
     Finder = new AutomationElementFinder(automationElement);
 }
Exemplo n.º 47
0
 public WPFListItem(AutomationElement automationElement, IActionListener actionListener)
     : base(automationElement, actionListener)
 {
     finder = new AutomationElementFinder(automationElement);
 }
Exemplo n.º 48
0
 public Label(AutomationElement automationElement, IActionListener actionListener)
     : base(automationElement, actionListener)
 {
 }
Exemplo n.º 49
0
 protected ContainerStrip(AutomationElement element, IActionListener listener)
     : base(element, listener, InitializeOption.NoCache, new NullWindowSession())
 {
 }
 public static ISuggestionList WaitAndFind(IActionListener actionListener)
 {
     return(WaitTill(actionListener, "Took too long to find suggestion list", obj => obj == null));
 }
Exemplo n.º 51
0
 public ProgressBar(AutomationElement automationElement, IActionListener actionListener)
     : base(automationElement, actionListener)
 {
 }
Exemplo n.º 52
0
 public TitleBar(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
     automationElementFinder = new AutomationElementFinder(automationElement);
 }
Exemplo n.º 53
0
 protected TreeNode(AutomationElement automationElement, IActionListener actionListener)
     : base(automationElement, actionListener)
 {
     finder = new AutomationElementFinder(automationElement);
 }
Exemplo n.º 54
0
 public TableHorizontalScrollBar(AutomationElement automationElement, IActionListener actionListener)
 {
 }
Exemplo n.º 55
0
 public NonCachedContainerItemFactory(PrimaryUIItemFactory factory, IActionListener actionListener)
 {
     this.factory        = factory;
     this.actionListener = actionListener;
 }
Exemplo n.º 56
0
 public ComboBox(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
     this.actionListener = actionListener;
 }
Exemplo n.º 57
0
 internal AttachedMouse(Mouse mouse, IActionListener actionListener)
 {
     this.actionListener = actionListener;
     this.mouse = mouse;
 }
Exemplo n.º 58
0
 public SilverlightComboBox(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Exemplo n.º 59
0
 public TableCellFactory(AutomationElement tableElement, IActionListener actionListener)
 {
     this.tableElement = tableElement;
     this.actionListener = actionListener;
 }
Exemplo n.º 60
0
 public NERGUI()
 {
     actor = new NERGUI.ActionPerformer(this);
 }