コード例 #1
0
        public void WhenUserClicksOnAnyOfTheAccountListed()
        {
            try
            {
                List <IWebElement> rows = new List <IWebElement>(AccountsPage.TableElement(SelectBrowser.driver).FindElements(By.TagName("tr")));
                rowscount = rows.Count;

                List <IWebElement> columns = new List <IWebElement>(SelectBrowser.driver.FindElements(By.XPath("//table[@id='accounts-jeopardy']//tbody//tr[1]/td")));
                colcount = columns.Count;

                for (int rownum = 1; rownum <= rowscount - 2; rownum++)
                {
                    List <IWebElement> rowCells = new List <IWebElement>(SelectBrowser.driver.FindElements(By.XPath("//table[@id='accounts-jeopardy']//tbody//tr[" + rownum + "]/td")));
                    for (int CellNumber = 0; CellNumber < rowCells.Count; CellNumber++)
                    {
                        string      text        = rowCells.ElementAt(CellNumber).Text;
                        IWebElement element     = rowCells.ElementAt(CellNumber).FindElement(By.TagName("a"));
                        string      textpresent = element.Text;
                        if (textpresent.Contains(ExcelRead.GetCellData(xlpath1, @"AccountsSheet", 1, 0)))
                        {
                            Synchronization.VisibleElement(SelectBrowser.driver, By.TagName("a"));
                            element.Click();
                            test.Log(Status.Pass, "Clicked on the Account==>" + ExcelRead.GetCellData(xlpath1, @"AccountsSheet", 1, 0));
                            break;
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception==>" + ex);
                ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png);
            }
        }
コード例 #2
0
 public void ThenUserShouldBeNavigatesToTheCorrectPage()
 {
     try
     {
         string texttitle = SelectBrowser.driver.Url;
         Assert.IsTrue(texttitle.Contains(ExcelRead.GetCellData(xlpath1, @"AccountsSheet", 1, 0)));
         test.Log(Status.Pass, "User Navigated to the Specfic Account Page");
     }
     catch (Exception ex)
     {
         Console.WriteLine("Exception==>" + ex);
         ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png);
     }
 }
コード例 #3
0
 public void WhenEnterUsernameAndPassword()
 {
     try
     {
         LoginPage.UsernameText(SelectBrowser.driver).SendKeys(ExcelRead.GetCellData(xlpath1, @"UserCredentials", 1, 0));
         LoginPage.PasswordText(SelectBrowser.driver).SendKeys(ExcelRead.GetCellData(xlpath1, @"UserCredentials", 1, 1));
         test.Log(Status.Pass, "Enter Username and Password");
     }
     catch (Exception ex)
     {
         Console.WriteLine("Exception==>" + ex);
         ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png);
     }
 }
コード例 #4
0
        public void ThenUserCanCompareColumnOfDownloadedXlsxFile()
        {
            string pendRenDownXlpath = @"C:\Users\Anuruddha.Tiwari\Downloads\quadrantThree.xlsx";

            try
            {
                string s1 = ActivityHomePage.BillingNameHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 0).Contains(s1));

                test.Info("Assert pass successfully for compare the 1st column header with respect to present header under Pending Renewals");

                string s2 = ActivityHomePage.PubCodeHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 1).Contains(s2));

                test.Info("Assert pass successfully for compare the 2nd column header with respect to present header under Pending Renewals");

                string s3 = ActivityHomePage.ContractEndHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 2).Contains(s3));

                test.Info("Assert pass successfully for compare the 3rd column header with respect to present header under Pending Renewals");


                string s4 = ActivityHomePage.ContractAmountHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 3).Contains(s4));

                test.Info("Assert pass successfully for compare the 4th column header with respect to present header under Pending Renewals");


                string s5 = ActivityHomePage.SalesCloseHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Pending Renewals", 0, 4).Contains(s5));

                test.Info("Assert pass successfully for compare the 5th column header with respect to present header under Pending Renewals");
                //Console.WriteLine("Assert pass for all 5 headers");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception==>" + ex);
                ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png);
            }
        }
コード例 #5
0
        public void ThenUserCanCompareHeaderColumnOfDownloadedXlsxFileWithWebPageHeader()
        {
            string pendRenDownXlpath = @"C:\Users\Anuruddha.Tiwari\Downloads\quadrantOne.xlsx";

            try
            {
                string s1 = ActivityHomePage.MonthStartHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 0).Contains(s1));

                test.Info("Assert pass successfully for compare the 1st column header with respect to present header under Media Sales");

                string s2 = ActivityHomePage.NewHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 1).Contains(s2));

                test.Info("Assert pass successfully for compare the 2nd column header with respect to present header under Media Sales");


                string s3 = ActivityHomePage.RenewHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 2).Contains(s3));

                test.Info("Assert pass successfully for compare the 3rd column header with respect to present header under Media Sales");


                string s4 = ActivityHomePage.TotalHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 3).Contains(s4));
                test.Info("Assert pass successfully for compare the 4th column header with respect to present header under Media Sales");


                //Assert Fail due to mismatch header

                string s5 = ActivityHomePage.PyFinalHeader(SelectBrowser.driver).Text;
                string s6 = ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 4);
                bool   b  = s6.Contains(s5);
                Console.WriteLine(b);
                test.Info("Assert Fail for compare the 5th column header with respect to present header under Media Sales");
                //Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 4).Contains(s5));



                string s7 = ActivityHomePage.RateHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 5).Contains(s7));
                test.Info("Assert pass successfully for compare the 2nd column header with respect to present header under Media Sales");



                //scrool
                IWebElement horizontal_scroll = ActivityHomePage.DeltaHeader(SelectBrowser.driver);
                ScrollHoriZontal.Hover(SelectBrowser.driver, horizontal_scroll);
                Thread.Sleep(10000);


                //After scrool

                string s8 = ActivityHomePage.DeltaHeader(SelectBrowser.driver).Text;
                Assert.IsTrue(ExcelRead.GetCellData(pendRenDownXlpath, @"Internet and TSpec sales", 0, 6).Contains(s8));
                test.Info("Assert pass successfully for compare the 2nd column header with respect to present header under Media Sales");
                // Console.WriteLine("Assert pass for all 6 headers");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception==>" + ex);
                ScreenshotPage.TakesScreenshotWithDate(@"Screesnhot", System.Drawing.Imaging.ImageFormat.Png);
            }
        }