Exemple #1
0
 public T GetFooterControl <T>(int column, int row, By selector = null, bool getContentWithinTDelement = false) where T : BaseControl
 {
     if (selector != null)
     {
         return(ControlFactory.CreateNew <T>(Driver, selector,
                                             new WebControl(Driver, By.CssSelector($"tfoot tr:nth-child({row}) td:nth-child({column})"), this)));
     }
     else
     {
         return(ControlFactory.CreateNew <T>(Driver,
                                             By.CssSelector($"tfoot tr:nth-child({row}) td:nth-child({column})"), this));
     }
 }
        /// <summary>
        /// Get the control of type T at the given position which match in the UI
        /// </summary>
        /// <typeparam name="T">Type of control to be returned. Example: WebControl, Button, Checkbox, Textbox</typeparam>
        /// <param name="position">Position of the element as visible in the UI</param>
        /// <returns></returns>
        public T Item <T>(int position) where T : BaseControl
        {
            (position <= TotalRaw).Should()
            .BeTrue($"The requested item position [{position}] is greater than the total items [{TotalRaw}] available in the UI now");

            var xpath = Driver.FindElements(By).Skip(position - 1).First().GetElementXPath(Driver, _excludeIdChecksForXpathCalculation);

            if (_scrollCustomEvent != null)
            {
                ControlFactory.CreateNew <WebControl>(Driver, By.XPath(xpath), ParentControl).ScrollTo();
                _scrollCustomEvent.Invoke();
            }

            if (_scrollCustomEventConditional != null)
            {
                ControlFactory.CreateNew <WebControl>(Driver, By.XPath(xpath), ParentControl).ScrollTo();
                _scrollCustomEventConditional.Invoke(position);
            }

            return(ControlFactory.CreateNew <T>(Driver, By.XPath(xpath), ParentControl));
        }