Example #1
0
        public int SelectPerPage(IWebElement recordsFound, IWebElement dropdownSelectPerPage, IWebElement goArrow)
        {
            SwitchToFrameHelper.ToDefaultContext(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainBody(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainFrame(PropertiesCollection.driver);

            int[] recOnPageArray = { 5, 10, 15, 20, 25, 30, 40, 50 };
            if (recOnPageArray[0] > ItemsFound(recordsFound))
            {
                PropertiesCollection._reportingTasks.Log(Status.Info, "ITEMS FOUND LESS : " + ItemsFound(recordsFound));
                return(0);
            }
            else
            {
                int i = 1;
                for (; i < recOnPageArray.Length; i++)
                {
                    if (recOnPageArray[i] >= ItemsFound(recordsFound))
                    {
                        PropertiesCollection._reportingTasks.Log(Status.Info, "ITEMS FOUND OK : " + ItemsFound(recordsFound));
                        break;
                    }
                }
                var selectElement = new SelectElement(dropdownSelectPerPage);
                selectElement.SelectByIndex(i - 1);
                var valueSelected = selectElement.SelectedOption.Text;
                goArrow.Click();
                PropertiesCollection._reportingTasks.Log(Status.Info, "Selected value...: " + valueSelected);
                return(Int32.Parse(valueSelected));
            }
        }
Example #2
0
        public int GetTableRecords(IList <IWebElement> rows)

        {
            SwitchToFrameHelper.ToDefaultContext(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainBody(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainFrame(PropertiesCollection.driver);
            int totalRows = rows.Count;

            PropertiesCollection._reportingTasks.Log(Status.Info, "There are rows in the grid...: " + totalRows);
            return(totalRows);
        }
Example #3
0
        public int ItemsFound(IWebElement element)
        {
            SwitchToFrameHelper.ToDefaultContext(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainBody(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainFrame(PropertiesCollection.driver);

            var result = Int32.Parse(element.Text);

            //PropertiesCollection._reportingTasks.Log(Status.Info, "ITEMS FOUND : " + result);
            return(result);
        }
Example #4
0
        public string PageOfPagesLogic(PagingData pagesQuantity)
        {
            SwitchToFrameHelper.ToDefaultContext(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainBody(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainFrame(PropertiesCollection.driver);

            IWebElement pagesaQua = PropertiesCollection.driver.FindElement(By.CssSelector(pagesQuantity.pagesQua));
            string      textPages = pagesaQua.Text;

            //PropertiesCollection._reportingTasks.Log(Status.Info, "pages text : " + textPages);
            return(textPages);
        }
Example #5
0
        public int GetPagesQuantity(PagingData pagesQuantity)
        {
            SwitchToFrameHelper.ToDefaultContext(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainBody(PropertiesCollection.driver);
            SwitchToFrameHelper.ToMainFrame(PropertiesCollection.driver);

            IWebElement pagesaQua = PropertiesCollection.driver.FindElement(By.CssSelector(pagesQuantity.pagesQua));
            string      textPages = pagesaQua.Text;

            string[] several = textPages.Split(' ');
            int      value   = Int32.Parse(several[2]);

            PropertiesCollection._reportingTasks.Log(Status.Info, "pages text : " + textPages);
            PropertiesCollection._reportingTasks.Log(Status.Info, "There are pages we have : " + value);
            return(value);
        }