Esempio n. 1
0
        public TElement Find <TElement>(IDriver driver, Find findContext, Core.By by)
            where TElement : class, Core.Controls.IElement
        {
            TElement result = default(TElement);
            string   testingFrameworkExpression = by.ToTestingFrameworkExpression();

            this.WaitForExists(driver, testingFrameworkExpression);
            var element = findContext.ByExpression(by.ToTestingFrameworkExpression());

            result = this.ResolveElement <TElement>(driver, element);

            return(result);
        }
        public TElement Find <TElement>(IDriver driver, Find findContext, Core.By by)
            where TElement : class, Core.Controls.IElement
        {
            TElement result = default(TElement);

            try
            {
                string testingFrameworkExpression = by.ToTestingFrameworkExpression();
                this.WaitForExists(driver, testingFrameworkExpression);
                var element = findContext.ByExpression(by.ToTestingFrameworkExpression());
                result = this.ResolveElement <TElement>(driver, element);
            }
            catch (Exception ex)
            {
                ////# region 9. Failed Tests Аnalysis- Chain of Responsibility Design Pattern
                ////this.excepionAnalyzer.MainApplicationHandler.HandleRequest(ex, driver);
                ////#endregion
                # region 10. Failed Tests Аnalysis- Ambient Context Design Pattern
                var mainApplicationHandler = UnityContainerFactory.GetContainer().Resolve <Handler>(ExceptionAnalyzerConstants.MainApplicationHandlerName);
                mainApplicationHandler.HandleRequest(ex, driver);
                #endregion
                throw;
            }
Esempio n. 3
0
        public bool IsElementPresent(Find findContext, Core.By by)
        {
            try
            {
                string controlFindExpression = by.ToTestingFrameworkExpression();
                Manager.Current.ActiveBrowser.RefreshDomTree();
                HtmlFindExpression hfe = new HtmlFindExpression(controlFindExpression);
                Manager.Current.ActiveBrowser.WaitForElement(hfe, 5000, false);
            }
            catch (TimeoutException)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 4
0
        public IEnumerable <TElement> FindAll <TElement>(IDriver driver, Find findContext, Core.By by)
            where TElement : class, Core.Controls.IElement
        {
            List <TElement> resolvedElements           = new List <TElement>();
            string          testingFrameworkExpression = by.ToTestingFrameworkExpression();

            this.WaitForExists(driver, testingFrameworkExpression);
            var elements = findContext.AllByExpression(testingFrameworkExpression);

            foreach (var currentElement in elements)
            {
                TElement result = this.ResolveElement <TElement>(driver, currentElement);
                resolvedElements.Add(result);
            }

            return(resolvedElements);
        }