private static void SelectYear(string tableXPath, string year)
        {
            for (var i = 1; i <= 4; i++)
            {
                for (var j = 1; j <= 5; j++)
                {
                    if (
                        !GenericHelper.IsElementPresentQuick(
                            By.XPath(tableXPath + "/tbody/tr[" + i + "]/td[" + j + "]//span")))
                    {
                        continue;
                    }

                    var aYear = ObjectRepository.Driver.FindElement(By.XPath(tableXPath + "/tbody/tr[" + i + "]/td[" + j + "]//span")).Text;
                    Logger.Debug(string.Format("Year : {0}", aYear));
                    if (!year.Equals(aYear, StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }

                    ObjectRepository.Driver.FindElement(By.XPath(tableXPath + "/tbody/tr[" + i + "]/td[" + j + "]//span")).Click();
                    return;
                }
            }
            Logger.Info(" Select Year " + year + " from " + tableXPath);
        }
        private static void SelectDay(string tableXPath, string day)
        {
            for (var i = 1; i <= 6; i++)
            {
                for (var j = 2; j <= 8; j++)
                {
                    if (
                        !GenericHelper.IsElementPresentQuick(
                            By.XPath(tableXPath + "/tbody/tr[" + i + "]/td[" + j + "]//span")))
                    {
                        continue;
                    }

                    var xpath = tableXPath + "/tbody/tr[" + i + "]/td[" + j + "]//span";

                    var aday = ObjectRepository.Driver.FindElement(By.XPath(xpath)).Text;
                    Logger.Debug(string.Format("Day : {0}", aday));
                    if (!day.Equals(aday, StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }

                    if (ObjectRepository.Driver.FindElement(By.XPath(xpath))
                        .GetAttribute("class")
                        .Contains("text-muted"))
                    {
                        continue;
                    }

                    ObjectRepository.Driver.FindElement(By.XPath(xpath)).Click();
                    return;
                }
            }
            Logger.Info(" Select Day " + day + " from " + tableXPath);
        }
Пример #3
0
        public static void ClickVerifyBtnInGrid(string gridXpath, int row, int column)
        {
            if (!GenericHelper.IsElementPresentQuick(
                    By.XPath(GetGridElementXpath(gridXpath, row, column) + "//i[2]")))
            {
                return;
            }

            var element =
                GenericHelper.GetElement(
                    By.XPath(GetGridElementXpath(gridXpath, row, column) + "//i[2]"));

            element.Click();
            GenericHelper.WaitForLoadingMask();
        }
Пример #4
0
        public static void VerifyIncentiveGridEntry(string gridXpath, string program, string startDate, string endDate,
                                                    string status)
        {
            for (var i = 1; i <= 100; i++)
            {
                if (!GenericHelper.IsElementPresentQuick(By.XPath(gridXpath + "//table//tbody//tr[" + i + "]//td[1]/a")))
                {
                    continue;
                }

                Assert.AreEqual(
                    GenericHelper.GetText(By.XPath(gridXpath + "//table//tbody//tr[" + i + "]//td[1]/a")), program);
                Assert.AreEqual(
                    GenericHelper.GetText(By.XPath(gridXpath + "//table//tbody//tr[" + i + "]//td[2]")), startDate);
                Assert.AreEqual(
                    GenericHelper.GetText(By.XPath(gridXpath + "//table//tbody//tr[" + i + "]//td[3]")), endDate);
                Assert.AreEqual(
                    GenericHelper.GetText(By.XPath(gridXpath + "//table//tbody//tr[" + i + "]//td[4]/span")), status);
            }
        }
Пример #5
0
        public static IWebElement GetGridElement(string gridXpath, int row, int column)
        {
            if (
                GenericHelper.IsElementPresentQuick(
                    By.XPath(GetGridElementXpath(gridXpath, row, column) + "/a")))
            {
                return(GenericHelper.GetElement(By.XPath(GetGridElementXpath(gridXpath, row, column) + "/a")));
            }

            if (
                GenericHelper.IsElementPresentQuick(
                    By.XPath(GetGridElementXpath(gridXpath, row, column) + "/span")))
            {
                return(GenericHelper.GetElement(By.XPath(GetGridElementXpath(gridXpath, row, column) + "/span")));
            }

            if (
                GenericHelper.IsElementPresentQuick(
                    By.XPath(GetGridElementXpath(gridXpath, row, column) + "/input")))
            {
                return(GenericHelper.GetElement(By.XPath(GetGridElementXpath(gridXpath, row, column) + "/input")));
            }

            if (
                GenericHelper.IsElementPresentQuick(
                    By.XPath(GetGridElementXpath(gridXpath, row, column) + "//input")))
            {
                return(GenericHelper.GetElement(By.XPath(GetGridElementXpath(gridXpath, row, column) + "//input")));
            }

            if (GenericHelper.IsElementPresentQuick(
                    By.XPath(GetGridElementXpath(gridXpath, row, column))))
            {
                return(GenericHelper.GetElement(By.XPath(GetGridElementXpath(gridXpath, row, column))));
            }

            Logger.Error(string.Format("Grid Element {0} not found", GetGridElementXpath(gridXpath, row, column)));

            return(null);
        }
Пример #6
0
 public static IWebElement GetGridHeaderElement(string gridXpath, int row, int column)
 {
     return(GenericHelper.IsElementPresentQuick(
                By.XPath(GetGridHeaderXpath(gridXpath, row, column))) ? GenericHelper.GetElement(By.XPath(GetGridHeaderXpath(gridXpath, row, column))) : null);
 }
Пример #7
0
 public static By GetDropDownWithLabelXpath(string label)
 {
     return(GenericHelper.IsElementPresentQuick(
                By.XPath("//label[text()='" + label + "']/following-sibling::div//span[text()='select']")) ? By.XPath("//label[text()='" + label + "']/following-sibling::div//span[text()='select']") : By.XPath("//label[text()='" + label + "']/following-sibling::span//span[text()='select']"));
 }