Example #1
0
 public static UITestControl GetControl(params string[] automationIDs)
 {
     if(_studioWindow == null)
     {
         _studioWindow = new UIMapBase.UIStudioWindow();
     }
     var control = GetChildByAutomationIdPath(_studioWindow, automationIDs);
     if(control == null)
     {
         throw new UITestControlNotFoundException();
     }
     return control;
 }
Example #2
0
        public static UITestControl GetControl(params string[] automationIDs)
        {
            if (_studioWindow == null)
            {
                _studioWindow = new UIMapBase.UIStudioWindow();
            }
            var control = GetChildByAutomationIdPath(_studioWindow, automationIDs);

            if (control == null)
            {
                throw new UITestControlNotFoundException();
            }
            return(control);
        }
Example #3
0
        /// <summary>
        /// Gets the control from the Window.
        /// Used to search pinned panes
        /// </summary>
        /// <param name="singleSearch">if set to <c>true</c> [single search].</param>
        /// <param name="splitPaneIndex">Index of the split pane.</param>
        /// <param name="startControl"></param>
        /// <param name="returnNullIfNotFound"></param>
        /// <param name="throwIfMultiple"></param>
        /// <param name="automationIDs">The automation attribute ds.</param>
        /// <returns></returns>
        public static UITestControl GetControlFromRoot(bool singleSearch, int splitPaneIndex, UITestControl startControl, bool returnNullIfNotFound, bool throwIfMultiple = false, params string[] automationIDs)
        {
            if (_studioWindow == null)
            {
                _studioWindow = new UIMapBase.UIStudioWindow();
                _studioWindow.Find();
            }

            if (automationIDs == null || automationIDs.Length == 0)
            {
                return(_studioWindow);
            }

            if (automationIDs.Length > 0)
            {
                UITestControl theControl = null;
                if (singleSearch)
                {
                    var automationCounter = 0;
                    while (automationCounter <= automationIDs.Length - 1)
                    {
                        var wpfControl   = startControl ?? _studioWindow;
                        var automationId = automationIDs[automationCounter];
                        theControl = automationId.EndsWith("*") ?  wpfControl.FindByFriendlyName(automationId, returnNullIfNotFound) :
                                     wpfControl.FindByAutomationId(automationId, returnNullIfNotFound, throwIfMultiple);
                        if (theControl == null && returnNullIfNotFound)
                        {
                            return(null);
                        }
                        startControl = theControl;
                        automationCounter++;
                    }
                    return(theControl);
                }
            }
            return(null);
        }
Example #4
0
        /// <summary>
        /// Gets the control from the Window.
        /// Used to search pinned panes
        /// </summary>
        /// <param name="singleSearch">if set to <c>true</c> [single search].</param>
        /// <param name="splitPaneIndex">Index of the split pane.</param>
        /// <param name="startControl"></param>
        /// <param name="returnNullIfNotFound"></param>
        /// <param name="throwIfMultiple"></param>
        /// <param name="automationIDs">The automation attribute ds.</param>
        /// <returns></returns>
        public static UITestControl GetControlFromRoot(bool singleSearch, int splitPaneIndex, UITestControl startControl, bool returnNullIfNotFound,bool throwIfMultiple=false, params string[] automationIDs)
        {
            if(_studioWindow == null)
            {
                _studioWindow = new UIMapBase.UIStudioWindow();
                _studioWindow.Find();
            }

            if(automationIDs == null || automationIDs.Length == 0)
            {
                return _studioWindow;
            }

            if(automationIDs.Length > 0)
            {
                UITestControl theControl = null;
                if(singleSearch)
                {
                    var automationCounter = 0;
                    while(automationCounter <= automationIDs.Length - 1)
                    {
                        var wpfControl = startControl ?? _studioWindow;
                        var automationId = automationIDs[automationCounter];
                        theControl = automationId.EndsWith("*") ?  wpfControl.FindByFriendlyName(automationId, returnNullIfNotFound) :
                                                                   wpfControl.FindByAutomationId(automationId, returnNullIfNotFound,throwIfMultiple);
                        if(theControl == null && returnNullIfNotFound)
                        {
                            return null;
                        }
                        startControl = theControl;
                        automationCounter++;
                    }
                    return theControl;
                }
            }
            return null;
        }