internal override object getTarget(IInvocation invocation)
        {
            if (cached != null)
            {
                return(cached);
            }

            Type  genericParameter = invocation.Method.DeclaringType.GetGenericArguments()[0];
            IList result           = GenericsUtility.CraeteInstanceOfSomeGeneric(typeof(List <>), genericParameter, new Type[] { },
                                                                                 new object[] { }) as IList;

            ITimeouts timeOuts = WebDriverUnpackUtility.UnpackWebdriver(locator.SearchContext).Manage().Timeouts();

            try
            {
                timeOuts.ImplicitlyWait(zeroTimeSpan);
                waitingForElementList.Timeout = waitingTimeSpan.WaitingDuration;
                ReadOnlyCollection <IWebElement> found = waitingForElementList.Until(ReturnWaitingFunction(locator, bys));
                result = convert(found, genericParameter);
            }
            catch (WebDriverTimeoutException ignored)
            {}
            finally
            {
                timeOuts.ImplicitlyWait(waitingTimeSpan.WaitingDuration);
            }

            if (shouldCache && cached == null)
            {
                cached = result;
            }

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ReAdd all managers.
        /// </summary>
        private void _reAddAllManagersFromInspector()
        {
            //COPY FROM MASTER LIST (FROM INSPECTOR)
            List <BaseManager> copyOfManagersList = new List <BaseManager>(managers);

            //CLEAR MASTER LIST
            managers.RemoveAll((abstractManager) => true);               //remove 'all'

            //ADD FROM COPY TO MASTER LIST
            //	NOTE: THIS PROPERLY CALLS THE ADD EVENTS WITHOUT THE DELETE EVENTS


            BaseManager aBaseManager;

            for (int index_int = copyOfManagersList.Count - 1; index_int >= 0; index_int--)
            {
                //
                aBaseManager = copyOfManagersList[index_int];
                //
                //WHY WOULD IT BE NULL? I THINK THERE IS A BLANK ADDED IN THE EDITORWINDOW, AND UNTIL WE DRAG SOMETHING THERE ITS BLANK (BLANKISH)
                if (aBaseManager != null)
                {
                    System.Type type = aBaseManager.GetType();
                    GenericsUtility.invokeGenericMethodByType(UMOM.Instance, "_addManagerByForce", type);
                }
            }
        }
        private IList convert(ReadOnlyCollection <IWebElement> original, Type genericParameter)
        {
            Type   generic = typeof(List <>).MakeGenericType(genericParameter);
            object result  = GenericsUtility.CraeteInstanceOfSomeGeneric(typeof(List <>), genericParameter, new Type[] { },
                                                                         new object[] { });
            IList list = result as IList;

            foreach (var elem in original)
            {
                list.Add(elem);
            }

            return(list);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Removes all managers.
        /// </summary>
        /// <returns>
        /// The all managers.
        /// </returns>
        public bool removeAllManagers()
        {
            bool wasSuccessful_boolean = true;

            System.Type toBeDestroyed_type;

            for (int count_int = managers.Count - 1; count_int >= 0; count_int--)
            {
                BaseManager aBaseManager = managers[count_int];
                if (aBaseManager != null)
                {
                    toBeDestroyed_type = aBaseManager.GetType();
                    GenericsUtility.invokeGenericMethodByType(UMOM.Instance, "removeManager", toBeDestroyed_type);
                }
            }

            return(wasSuccessful_boolean);
        }