Пример #1
0
        public static string GetColumnValues(string locator, int row, int col)
        {
            string columnxPath = GetTableXpath(locator, row, col);
            string colValue    = string.Empty;

            if (GenericHelper.IsElementPresent(By.XPath(columnxPath)))
            {
                colValue = ObjectRepository.driver.FindElement(By.XPath(columnxPath)).Text;
                logs.Info("Returned column value: " + colValue);
            }
            return(colValue);
        }
Пример #2
0
        private static IWebElement GetGridElement(string locator, int row, int col)
        {
            var xPath = GetTableXpath(locator, row, col);

            if (GenericHelper.IsElementPresent(By.XPath(xPath + "//a")))
            {
                return(ObjectRepository.driver.FindElement(By.XPath(xPath + "//a")));    //for link and button
            }
            else if (GenericHelper.IsElementPresent(By.XPath(xPath + "//input")))
            {
                return(ObjectRepository.driver.FindElement(By.XPath(xPath + "//input")));        //for text box
            }
            else
            {
                return(ObjectRepository.driver.FindElement(By.XPath(xPath)));
            }
        }
Пример #3
0
        public static IList <string> GetAllValuesInTable(string locator)
        {
            List <string> list = new List <string>();
            var           row  = 1;
            var           col  = 1;

            while (GenericHelper.IsElementPresent(By.XPath(GetTableXpath(locator, row, col))))
            {
                while (GenericHelper.IsElementPresent(By.XPath(GetTableXpath(locator, row, col))))
                {
                    //Console.WriteLine(GetColumnValues(locator, row, col));
                    list.Add(GetColumnValues(locator, row, col));
                    col++;
                }
                row++;
                col = 1;
            }
            return(list);
        }
Пример #4
0
        public static int GetRowByStudyNameAndProtcol(string locator, string RowText, string protcol)
        {
            var row      = 1;
            int finalrow = 0;

            while (GenericHelper.IsElementPresent(By.XPath(GetTableXpath(locator, row, 2))))
            {
                string colstudyText = GetColumnValues(locator, row, 2);
                if (colstudyText == RowText)
                {
                    finalrow = row;
                    string actProtocolText = GetColumnValues(locator, finalrow, 1);
                    if (actProtocolText.Equals(protcol))
                    {
                        logs.Info("Row number located: " + finalrow);
                        break;
                    }
                    row = finalrow;
                }
                row++;
            }
            return(finalrow);
        }