Пример #1
0
        private ElemsType FindIfrElements(BaseClasses.By by)
        {
            switch (by.CurrType)
            {
            case (int)BaseClasses.By.PossibleTypes.Class:
                return(FindElements(SelBy.ClassName(by.CurrValue)));

            case (int)BaseClasses.By.PossibleTypes.CssSelector:
                return(FindElements(SelBy.CssSelector(by.CurrValue)));

            case (int)BaseClasses.By.PossibleTypes.Id:
                return(FindElements(SelBy.Id(by.CurrValue)));

            case (int)BaseClasses.By.PossibleTypes.Name:
                return(FindElements(SelBy.Name(by.CurrValue)));

            case (int)BaseClasses.By.PossibleTypes.Xpath:
                return(FindElements(SelBy.XPath(by.CurrValue)));
            }

            throw new Exception("Something going wrong, dude!");
        }
Пример #2
0
        /// <summary>
        /// Find Web Element.
        /// If element is not ready by Await parameter or absent on the page, it will be seached in period of time configured in paramsLib
        /// </summary>
        /// <param name="by">Configure by what need to search web element</param>
        /// <param name="awaitFor">Await.Visible() or Await.Visible(1000 -- like timeout)</param>
        /// <returns>element wrapper "ElemType"</returns>
        public ElemType Elem(BaseClasses.By by, Await awaitFor)
        {
            TimerTest timer  = new TimerTest();
            ElemType  elType = new ElemType(this);

            if (awaitFor.TimeOut < 0)
            {
                throw new Exception("Wait period cannot be less than 0");
            }

            if (awaitFor.Value == string.Empty)
            {
                elType = FindIfrElement(by);

                if (!elType.IsNull)
                {
                    return(elType);
                }
            }

            for (; timer.GetElapsedTime() < awaitFor.TimeOut;)
            {
                ElemType webElement = FindIfrElement(by);

                if (IsElementReady(webElement, awaitFor))
                {
                    timer.Finish("Element changed status to ready in ");

                    return(webElement);
                }
            }

            timer.Finish("Element wasnt changed it's status to requested in ");

            return(elType);
        }
Пример #3
0
 /// <summary>
 /// Find Web Element.
 /// If element is not visible or absent on the page, it will be seached in period of time configured in paramsLib
 /// </summary>
 /// <param name="by">Configure by what need to search web element</param>
 /// <returns></returns>
 public ElemType Elem(BaseClasses.By by)
 {
     return(Elem(by, Await.Present()));
 }
Пример #4
0
 public ElemsType Elems(BaseClasses.By by)
 {
     return(FindIfrElements(by));
 }