public void IssueInvoice02_InternalPayer_CreateInvoice_2LineItems_GST_Deal_N0Surcharge_WithHTMLTagsValues() { HomePage HomePg = new HomePage(WebDriver); try { WebDriver.Manage().Window.Maximize(); WebDriver.Navigate().GoToUrl("https://demo.billzy.com/home"); LoginPage loginPage = new LoginPage(WebDriver); SendPage SendPg = new SendPage(WebDriver); ReceivedPage Recpg = new ReceivedPage(WebDriver); BillzyCashModal BillzyCashMlPg = new BillzyCashModal(WebDriver); SIVPage SIVPG1 = new SIVPage(WebDriver); loginPage.UserNameTextBox().Click(); loginPage.UserNameTextBox().SendKeys("*****@*****.**"); loginPage.PasswordTextBox().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); loginPage.PasswordTextBox().SendKeys("Cognito1"); SeleniumSetMethods.WaitOnPage(secdelay2); loginPage.LoginButton().Click(); SeleniumSetMethods SetMethods = new SeleniumSetMethods(WebDriver); SeleniumSetMethods.WaitOnPage(secdelay8); IssueInvoicePage IssueInvoicePg = new IssueInvoicePage(WebDriver); IssueInvoicePg.IssueInvoiceButton().Click(); SeleniumSetMethods.WaitOnPage(secdelay3); IWebElement bodyTag = WebDriver.FindElement(By.TagName("body")); AddCustomerPage AddCustomerPg = new AddCustomerPage(WebDriver); Random rand = new Random(); DateTime dt = new DateTime(); string dtString = dt.ToString("MM/dd/yyyy HH:mm:ss"); int randnumber1 = rand.Next(); IssueInvoicePg.BusinessName().Click(); SeleniumSetMethods.WaitOnPage(secdelay1); IssueInvoicePg.BusinessName().SendKeys("madcowtesting10+A"); SeleniumSetMethods.WaitOnPage(secdelay1); IssueInvoicePg.SelectBusiness().Click(); SeleniumSetMethods.WaitOnPage(secdelay3); String PaymentTerms = "60 days"; IssueInvoicePg.PaymentTerms().SendKeys(PaymentTerms); IssueInvoicePg.CreateInvoice().Click(); string invref = "script > alert(\"Hello\");</ script >"; IssueInvoicePg.InvoiceReferenceCreate().SendKeys(invref); IssueInvoicePg.Description().SendKeys("Test Invoice issued to External Payer"); IssueInvoicePg.LineItemAmount().SendKeys("299.10"); SeleniumSetMethods.WaitOnPage(secdelay2); IssueInvoicePg.Message().SendKeys(invref); string subject = IssueInvoicePg.Subject().GetAttribute("value"); string TotalGSTMsg = IssueInvoicePg.TotalGSTMsg().Text; string TotalValue = IssueInvoicePg.TotalValue().Text; SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(subject.Contains("madcowtesting10+IntPayCreateInv has sent you an invoice") && TotalGSTMsg.Contains("(incl. GST)") && TotalValue.Contains("$329.01")); IssueInvoicePg.BillzyDealBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); IssueInvoicePg.NewTotal().SendKeys("200"); IssueInvoicePg.Comments().SendKeys(invref); IWebElement bodyTag1 = WebDriver.FindElement(By.TagName("body")); bool disc1 = bodyTag1.Text.Contains("39.21% discount"); SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(disc1 == true); bool disc2 = bodyTag1.Text.Contains("Due in 60 days"); SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(disc2 == true); // IssueInvoicePg.SurchargeCheckbox().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); IssueInvoicePg.SendInvoiceBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay5); IWebElement bodyTag2 = WebDriver.FindElement(By.TagName("body")); bool err23 = bodyTag2.Text.Contains("Unfortunately there was an internal system error. Please try again in 2 minutes or contact Billzy support."); SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(err23 == true); IssueInvoicePg.InvoiceReferenceCreate().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); IssueInvoicePg.InvoiceReferenceCreate().Clear(); SeleniumSetMethods.WaitOnPage(secdelay2); IssueInvoicePg.InvoiceReferenceCreate().SendKeys("Int-Inv@" + randnumber1); SeleniumSetMethods.WaitOnPage(secdelay2); IssueInvoicePg.SendInvoiceBTN().Click(); SeleniumSetMethods.WaitOnPage(secdelay5); SendPg.SearchInvoiceSent().SendKeys("Int-Inv@" + randnumber1); SeleniumSetMethods.WaitOnPage(secdelay2); SendPg.BillzyRefResult().Click(); SeleniumSetMethods.WaitOnPage(secdelay5); SIVPG1.ToggleDealHistory().Click(); SeleniumSetMethods.WaitOnPage(secdelay2); //string invref1 = "script>alert(\"Hello\")"; string commvalue = SIVPG1.DiscountHistoryComment01().Text; SeleniumSetMethods.WaitOnPage(secdelay2); Assert.IsTrue(commvalue.Contains(invref)); } finally { SeleniumSetMethods.WaitOnPage(secdelay2); WebDriver.Navigate().GoToUrl("https://demo.billzy.com/received"); SeleniumSetMethods.WaitOnPage(secdelay4); HomePg.SignOutBTN().Click(); } }