static IWebDriver LoginMailRu(string login, string password)//method for login in mail.ru account, returns ChromeDriver after login { string mailruURL = "https://mail.ru/"; string idOfLoginField = "mailbox:login"; string idOfPasswordField = "mailbox:password"; int timeoutInSeconds = 5; IWebDriver chromeDriver = new ChromeDriver(); chromeDriver.Navigate().GoToUrl(mailruURL); IWebElement loginField = new WebDriverWait(chromeDriver, TimeSpan.FromSeconds(timeoutInSeconds)).Until(ExpectedConditions.ElementIsVisible(By.Id(idOfLoginField))); loginField.SendKeys(login + Keys.Enter); IWebElement passwordField = new WebDriverWait(chromeDriver, TimeSpan.FromSeconds(timeoutInSeconds)).Until(ExpectedConditions.ElementIsVisible(By.Id(idOfPasswordField))); passwordField.SendKeys(password + Keys.Enter); return(chromeDriver); }
private void WaitForElement(By locator) { new WebDriverWait(webDriver, TimeSpan.FromSeconds(10)).Until(ExpectedConditions.ElementIsVisible(locator)); }
public void ShouldAddCustomer() { // When I proceed to "Bank Manager Login" ngDriver.FindElement(NgBy.ButtonText("Bank Manager Login")).Click(); // And I proceed to "Add Customer" ngDriver.FindElement(NgBy.PartialButtonText("Add Customer")).Click(); // And I fill new Customer data IWebElement ng_first_name = ngDriver.FindElement(NgBy.Model("fName")); ngDriver.Highlight(ng_first_name, highlight_timeout); StringAssert.IsMatch("First Name", ng_first_name.GetAttribute("placeholder")); ng_first_name.SendKeys("John"); IWebElement ng_last_name = ngDriver.FindElement(NgBy.Model("lName")); ngDriver.Highlight(ng_last_name, highlight_timeout); StringAssert.IsMatch("Last Name", ng_last_name.GetAttribute("placeholder")); ng_last_name.SendKeys("Doe"); IWebElement ng_post_code = ngDriver.FindElement(NgBy.Model("postCd")); ngDriver.Highlight(ng_post_code, highlight_timeout); StringAssert.IsMatch("Post Code", ng_post_code.GetAttribute("placeholder")); ng_post_code.SendKeys("11011"); // NOTE: there are two 'Add Customer' buttons on this form NgWebElement ng_add_customer_button = ngDriver.FindElements(NgBy.PartialButtonText("Add Customer"))[1]; actions.MoveToElement(ng_add_customer_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_add_customer_button, highlight_timeout); ng_add_customer_button.Submit(); // confirm string alert_text = null; try { alert = ngDriver.WrappedDriver.SwitchTo().Alert(); alert_text = alert.Text; StringAssert.StartsWith("Customer added successfully with customer id :", alert_text); alert.Accept(); } catch (NoAlertPresentException ex) { // Alert not present verificationErrors.Append(ex.StackTrace); } catch (WebDriverException ex) { // Alert not handled by PhantomJS verificationErrors.Append(ex.StackTrace); } int customer_id = 0; int.TryParse(alert_text.FindMatch(@"(?<customer_id>\d+)$"), out customer_id); Assert.AreNotEqual(0, customer_id); // And I switch to "Customers" screen ngDriver.FindElement(NgBy.PartialButtonText("Customers")).Click(); // discover newly added customer ReadOnlyCollection <NgWebElement> ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); int customer_count = ng_customers.Count; NgWebElement ng_new_customer = ng_customers.First(cust => Regex.IsMatch(cust.Text, "John Doe")); Assert.IsNotNull(ng_new_customer); actions.MoveToElement(ng_new_customer.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_new_customer, highlight_timeout); // confirm searching for the customer name ngDriver.FindElement(NgBy.Model("searchCustomer")).SendKeys("John"); ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); Assert.AreEqual(1, ng_customers.Count); // show all customers again ngDriver.FindElement(NgBy.Model("searchCustomer")).Clear(); Thread.Sleep(500); wait.Until(ExpectedConditions.ElementIsVisible(NgBy.Repeater("cust in Customers"))); // discover newly added customer again ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); ng_new_customer = ng_customers.First(cust => Regex.IsMatch(cust.Text, "John Doe")); // delete new customer NgWebElement ng_delete_button = ng_new_customer.FindElement(NgBy.ButtonText("Delete")); Assert.IsNotNull(ng_delete_button); actions.MoveToElement(ng_delete_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_delete_button, highlight_timeout); // in slow motion actions.MoveToElement(ng_delete_button.WrappedElement).ClickAndHold().Build().Perform(); Thread.Sleep(1000); actions.Release(); // sometimes actions do not work - for example in this test ng_delete_button.Click(); // wait for customer list to reload Thread.Sleep(1000); wait.Until(ExpectedConditions.ElementIsVisible(NgBy.Repeater("cust in Customers"))); // count the remaining customers ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); int new_customer_count = ng_customers.Count; // conrirm the customer count changed Assert.IsTrue(customer_count - 1 == new_customer_count); }
public void FillForm(Dictionary <String, String> obj1) { string AdmType = obj1["AdmType"]; string FirstName = obj1["FirstName"]; string LastName = obj1["LastName"]; string Gender = obj1["Gender"]; string month = obj1["month"]; string day = obj1["day"]; string year = obj1["year"]; string AdmitHospital = obj1["AdmitHospital"]; string AdmitGroup = obj1["AdmitGroup"]; string ETA = obj1["ETA"]; string temp = obj1["temp"]; string Bpsystolic = obj1["Bpsystolic"]; string BpDiastolic = obj1["BpDiastolic"]; string pulse = obj1["pulse"]; string respiration = obj1["respiration"]; string wcb = obj1["wcb"]; string Cc = obj1["Cc"]; string TravelWA = obj1["TravelWA"]; string ebola = obj1["ebola"]; string sepsis = obj1["sepsis"]; string Suspected = obj1["Suspected"]; string Condition = obj1["Condition"]; string BedType = obj1["Bedtype"]; string stable = obj1["stable"]; string evaluated = obj1["evaluated"]; string voluntary = obj1["voluntary"]; string submitForm = obj1["submitForm"]; string guardian = obj1["guardian"]; string dementia = obj1["dementia"]; string drug = obj1["drug"]; string mental = obj1["mental"]; string pending = obj1["pending"]; string delirium = obj1["delirium"]; //edreferrel string Isolation = obj1["Isolation"]; string fever = obj1["fever"]; string aches = obj1["fatigue"]; string fatigue = obj1["fatigue"]; string diarrhea = obj1["diarrhea"]; string bleeding = obj1["bleeding"]; string paperwork = obj1["paperwork"]; Thread.Sleep(2000); wait.Until(ExpectedConditions.ElementIsVisible((By.LinkText("Form")))); driver.FindElement(By.LinkText("Form")).Click(); wait.Until(ExpectedConditions.ElementIsVisible((By.Id("alertify-ok")))); driver.FindElement(By.Id("alertify-ok")).Click(); string directadmission = "//*[@id='formtype-checks']/div/label[1]/i"; string Phychadmission = "//*[@id='formtype-checks']/div/label[3]/i"; string Edrefadmission = "//*[@id='formtype-checks']/div/label[2]/i"; //direct admission if (AdmType == "Direct") { IWebElement admission = driver.FindElement(By.XPath(directadmission)); admission.Click(); } else if (AdmType == "Phych") { IWebElement admission = driver.FindElement(By.XPath(Phychadmission)); admission.Click(); } else { IWebElement admission = driver.FindElement(By.XPath(Edrefadmission)); admission.Click(); } Thread.Sleep(3000); driver.FindElement(By.Id("alertify-ok")).Click(); driver.FindElement(By.Id("fName")).SendKeys(FirstName); driver.FindElement(By.Id("lName")).SendKeys(LastName); if (Gender == "Male") { driver.FindElement(By.XPath("//*[@id='gender']/label[2]/i")).Click(); } else { driver.FindElement(By.XPath("//*[@id='gender']/label[1]/i")).Click(); } driver.FindElement(By.XPath("//*[@id='Patient']/div/div[1]/div/fieldset[1]/div/div/div[4]/div[1]/select[1]")).SendKeys(month); driver.FindElement(By.Id("idDob")).SendKeys(day); driver.FindElement(By.XPath("//*[@id='Patient']/div/div[1]/div/fieldset[1]/div/div/div[4]/div[1]/select[2]")).SendKeys(year); if (AdmType == "Edreferral") { if (Isolation == "No") { driver.FindElement(By.XPath("//*[@id='radIsoc']/label[1]/i")).Click(); } else { } if (fever == "No") { driver.FindElement(By.XPath("//*[@id='fever']/label[1]/i")).Click(); } else { } if (aches == "No") { driver.FindElement(By.XPath("//*[@id='ache']/label[1]/i")).Click(); } else { } if (fatigue == "No") { driver.FindElement(By.XPath("//*[@id='weak']/label[1]/i")).Click(); } else { } if (diarrhea == "No") { driver.FindElement(By.XPath("//*[@id='pain']/label[1]/i")).Click(); } else { } if (bleeding == "No") { driver.FindElement(By.XPath("//*[@id='bleed']/label[1]/i")).Click(); } else { } if (paperwork == "No") { driver.FindElement(By.XPath("//*[@id='quest-fax']/label[3]/i")).Click(); } else { } } driver.FindElement(By.Id("sHosps")).SendKeys(AdmitHospital); if (AdmType == "Direct" || AdmType == "Phych") { if (AdmitGroup == "Himanshu demo") { driver.FindElement(By.XPath("//*[@id='sgsGrps']/label[1]/i")).Click(); } driver.FindElement(By.XPath("//*[@id='sPeta']")).SendKeys(ETA); } driver.FindElement(By.XPath("//*[@id='cComplaint']")).SendKeys(Cc); if (AdmType == "Direct") { driver.FindElement(By.XPath("//*[@id='intemp']")).SendKeys(temp); driver.FindElement(By.XPath("//*[@id='bpSystolic']")).SendKeys(Bpsystolic); driver.FindElement(By.XPath("//*[@id='bpDiastolic']")).SendKeys(BpDiastolic); driver.FindElement(By.XPath("//*[@id='inpulse']")).SendKeys(pulse); driver.FindElement(By.XPath("//*[@id='inrespiration']")).SendKeys(respiration); driver.FindElement(By.XPath("//*[@id='inwbc']")).SendKeys(wcb); } if (AdmType == "Direct" || AdmType == "Edreferral") { if (TravelWA == "Yes") { driver.FindElement(By.XPath("//*[@id='travel']/label[1]/i")).Click(); } else { } if (ebola == "Yes") { driver.FindElement(By.XPath("//*[@id='contact']/label[1]/i")).Click(); } else { } } if (AdmType == "Direct") { if (sepsis == "No") { driver.FindElement(By.XPath("//*[@id='chcsirs']/label[5]/i")).Click(); } else { } driver.FindElement(By.XPath("//*[@id='idsrc']")).SendKeys(Suspected); driver.FindElement(By.XPath("//*[@id='sConds']")).SendKeys(Condition); driver.FindElement(By.XPath("//*[@id='sBt']")).SendKeys(BedType); } if (AdmType == "Phych") { if (stable == "No") { driver.FindElement(By.XPath("//*[@id='mstable']/label[1]/i")).Click(); } else { } if (evaluated == "No") { driver.FindElement(By.XPath("//*[@id='eveph']/label[1]/i")).Click(); } else { } if (voluntary == "No") { driver.FindElement(By.XPath("//*[@id='volin']/label[1]/i")).Click(); } else { } ///form 2nd part phych// driver.FindElement(By.XPath("//*[@id='next-button']")).Click(); if (submitForm == "online") { driver.FindElement(By.XPath("//*[@id='Psych-Info']/div/div/div/fieldset/div/div/div[1]/div/div[1]/label[1]/i")).Click(); } else { } if (guardian == "No") { driver.FindElement(By.XPath("//*[@id='Psych-Info']/div/div/div/fieldset/div/div/div[2]/div[1]/label[2]/i")).Click(); } else { } if (dementia == "No") { driver.FindElement(By.XPath("//*[@id='Psych-Info']/div/div/div/fieldset/div/div/div[5]/div[1]/label[2]/i")).Click(); } else { } if (drug == "No") { driver.FindElement(By.XPath("//*[@id='Psych-Info']/div/div/div/fieldset/div/div/div[6]/div[1]/label[2]/i")).Click(); } else { } if (mental == "No") { driver.FindElement(By.XPath("//*[@id='Psych-Info']/div/div/div/fieldset/div/div/div[7]/div[1]/label[2]/i")).Click(); } else { } if (pending == "No") { driver.FindElement(By.XPath("//*[@id='Psych-Info']/div/div/div/fieldset/div/div/div[8]/div[1]/label[2]/i")).Click(); } else { } if (delirium == "No") { driver.FindElement(By.XPath("//*[@id='Psych-Info']/div/div/div/fieldset/div/div/div[9]/div[1]/label[2]/i")).Click(); } else { } } driver.FindElement(By.Id("admit-submit")).Click(); wait.Until(ExpectedConditions.ElementIsVisible((By.XPath("//*[@id='rootEle']/body/div[12]/div[3]/div/button")))); driver.FindElement(By.XPath("//*[@id='rootEle']/body/div[12]/div[3]/div/button")).Click(); }
public IWebElement FindElement(By by) { new WebDriverWait(_driver, TimeSpan.FromSeconds(5)).Until(ExpectedConditions.ElementIsVisible(by)); return(_driver.FindElement(by)); }
public IWebElement waitForPageUntilElementIsVisible(By locator, int maxSeconds) { return(new WebDriverWait(Webdriver, TimeSpan.FromSeconds(maxSeconds)) .Until(ExpectedConditions.ElementIsVisible((locator)))); }
public static IWebElement WaitForElement(IWebDriver driver, By by, int timeOutinSeconds) { WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeOutinSeconds)); return(wait.Until(ExpectedConditions.ElementIsVisible(by))); }
public static void WaitForVisibleElement(IWebDriver driver, By by) { By path = by; IWait <IWebDriver> wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); IWebElement element = wait.Until(ExpectedConditions.ElementIsVisible(path)); }
public void WaitForTitle() { wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(titlePath))); }
public void SetPassword(string password) { webDriverWait.Until(ExpectedConditions.ElementIsVisible(By.Name("password"))); PasswordField.SendKeys(password); }
public void FillInfo(string FirstName, string LastName, string Email, string City, string Address, string PostalCode, string PhoneNumber, string PONumber) { // Fill the info // billing address SelectElement selectAddress = new SelectElement(driver.FindElement(By.Id("billing-address-select"))); selectAddress.SelectByText("New Address"); driver.FindElement(By.Id("BillingNewAddress_FirstName")).Clear(); driver.FindElement(By.Id("BillingNewAddress_FirstName")).SendKeys(FirstName); driver.FindElement(By.Id("BillingNewAddress_LastName")).Clear(); driver.FindElement(By.Id("BillingNewAddress_LastName")).SendKeys(LastName); driver.FindElement(By.Id("BillingNewAddress_Email")).Clear(); driver.FindElement(By.Id("BillingNewAddress_Email")).SendKeys(Email); SelectElement selectBillingCountry = new SelectElement(driver.FindElement(By.Id("BillingNewAddress_CountryId"))); selectBillingCountry.SelectByText("China"); driver.FindElement(By.Id("BillingNewAddress_City")).Clear(); driver.FindElement(By.Id("BillingNewAddress_City")).SendKeys(City); driver.FindElement(By.Id("BillingNewAddress_Address1")).Clear(); driver.FindElement(By.Id("BillingNewAddress_Address1")).SendKeys(Address); driver.FindElement(By.Id("BillingNewAddress_ZipPostalCode")).Clear(); driver.FindElement(By.Id("BillingNewAddress_ZipPostalCode")).SendKeys(PostalCode); driver.FindElement(By.Id("BillingNewAddress_PhoneNumber")).Clear(); driver.FindElement(By.Id("BillingNewAddress_PhoneNumber")).SendKeys(PhoneNumber); driver.FindElement(By.CssSelector("div#checkout-step-billing>div#billing-buttons-container>input.button-1")).Click(); // shipping address WebDriverWait waitUntilShippingAddress = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); waitUntilShippingAddress.Until(ExpectedConditions.ElementIsVisible(By.Id("shipping-address-select"))); SelectElement select1 = new SelectElement(driver.FindElement(By.Id("shipping-address-select"))); select1.SelectByText("New Address"); driver.FindElement(By.Id("ShippingNewAddress_FirstName")).Clear(); driver.FindElement(By.Id("ShippingNewAddress_FirstName")).SendKeys(FirstName); driver.FindElement(By.Id("ShippingNewAddress_LastName")).Clear(); driver.FindElement(By.Id("ShippingNewAddress_LastName")).SendKeys(LastName); driver.FindElement(By.Id("ShippingNewAddress_Email")).Clear(); driver.FindElement(By.Id("ShippingNewAddress_Email")).SendKeys(Email); SelectElement selectShippingCountry = new SelectElement(driver.FindElement(By.Id("ShippingNewAddress_CountryId"))); selectShippingCountry.SelectByText("China"); driver.FindElement(By.Id("ShippingNewAddress_City")).Clear(); driver.FindElement(By.Id("ShippingNewAddress_City")).SendKeys(City); driver.FindElement(By.Id("ShippingNewAddress_Address1")).Clear(); driver.FindElement(By.Id("ShippingNewAddress_Address1")).SendKeys(Address); driver.FindElement(By.Id("ShippingNewAddress_ZipPostalCode")).Clear(); driver.FindElement(By.Id("ShippingNewAddress_ZipPostalCode")).SendKeys(PostalCode); driver.FindElement(By.Id("ShippingNewAddress_PhoneNumber")).Clear(); driver.FindElement(By.Id("ShippingNewAddress_PhoneNumber")).SendKeys(PhoneNumber); driver.FindElement(By.CssSelector("div#shipping-buttons-container>input")).Click(); // shipping method WebDriverWait waitUntilMethodList = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); waitUntilMethodList.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div.shipping-method>ul.method-list"))); driver.FindElement(By.CssSelector("ul.method-list input#shippingoption_1")).Click(); driver.FindElement(By.CssSelector("div#shipping-method-buttons-container>input.shipping-method-next-step-button")).Click(); // payment method WebDriverWait waitUntilPaymentMethodList = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); waitUntilPaymentMethodList.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div.payment-method div.method-name img[alt='Purchase Order']"))); driver.FindElement(By.CssSelector("div.payment-method div.payment-details>input#paymentmethod_3")).Click(); driver.FindElement(By.CssSelector("div#payment-method-buttons-container>input.payment-method-next-step-button")).Click(); // payment information WebDriverWait waitUntilPONumber = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); waitUntilPONumber.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div.payment-info table>tbody>tr"))); driver.FindElement(By.CssSelector("div.payment-info tbody input#PurchaseOrderNumber")).Clear(); driver.FindElement(By.CssSelector("div.payment-info tbody input#PurchaseOrderNumber")).SendKeys(PONumber); driver.FindElement(By.CssSelector("div#payment-info-buttons-container>input.payment-info-next-step-button")).Click(); }
public string FTP_NVWashoe(string address, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel) { GlobalClass.global_orderNo = orderNumber; HttpContext.Current.Session["orderNo"] = orderNumber; GlobalClass.global_parcelNo = parcelNumber; //GlobalClass.global_county = county; string outparcelno = "", siteaddr = "", owner1 = "", legal_desc = "", year_built = "", tax_authority = "", sub_div = "", T_legal_desc; string valued_year = "", tax_year = "", assess_land = "", ass_improve = "", ass_total = "", tax_value = "", exem = "", pathid = ""; var driverService = PhantomJSDriverService.CreateDefaultService(); driverService.HideCommandPromptWindow = true; string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = ""; using (driver = new PhantomJSDriver()) { try { StartTime = DateTime.Now.ToString("HH:mm:ss"); if (searchType == "titleflex") { gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "NV", "Washoe"); if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes")) { driver.Quit(); return("MultiParcel"); } else if (HttpContext.Current.Session["titleparcel"].ToString() == "") { HttpContext.Current.Session["Nodata_NVWashoe"] = "Yes"; driver.Quit(); return("No Data Found"); } parcelNumber = HttpContext.Current.Session["titleparcel"].ToString(); searchType = "parcel"; } if (searchType == "address") { driver.Navigate().GoToUrl("https://www.washoecounty.us/assessor/cama/index.php"); driver.FindElement(By.Id("street_address")).SendKeys(address); gc.CreatePdf_WOP(orderNumber, "InputPassed_AddressSearch", driver, "NV", "Washoe"); driver.FindElement(By.Name("situssubmit")).SendKeys(Keys.Enter); Thread.Sleep(7000); By Icount = By.Id("search_results_info"); if (Exists(Icount)) { // success multiparcel(orderNumber); HttpContext.Current.Session["multiParcel_NVWashoe"] = "Yes"; return("MultiParcel"); } } else if (searchType == "parcel") { driver.Navigate().GoToUrl("https://www.washoecounty.us/assessor/cama/index.php"); driver.FindElement(By.Id("parid")).SendKeys(parcelNumber); gc.CreatePdf(orderNumber, parcelNumber, "InputPassed_ParcelSearch", driver, "NV", "Washoe"); driver.FindElement(By.Id("apnsubmit")).SendKeys(Keys.Enter); Thread.Sleep(7000); } else if (searchType == "ownername") { //Thread.Sleep(3000); driver.Navigate().GoToUrl("https://www.washoecounty.us/assessor/cama/index.php"); driver.FindElement(By.Id("o_lastname")).SendKeys(ownername); gc.CreatePdf_WOP(orderNumber, "InputPassed_OwnerNameSearch", driver, "NV", "Washoe"); driver.FindElement(By.Name("ownsubmit")).SendKeys(Keys.Enter); Thread.Sleep(7000); bool norec = false; try { Thread.Sleep(3000); IWebElement norecord = driver.FindElement(By.XPath("//*[@id='search_div']/div[1]")); string[] name = ownername.Split(null); string firstname = name[0]; string lastname = name[1]; if (firstname.Contains(",") && lastname.Contains(",")) { firstname = firstname.Replace(",", "").Trim(); lastname = lastname.Replace(",", "").Trim(); } if (lastname.Length == 1) { driver.FindElement(By.Id("o_firstname")).SendKeys(firstname); gc.CreatePdf_WOP(orderNumber, "InputPassed_OwnerNameSearch", driver, "NV", "Washoe"); driver.FindElement(By.Name("ownsubmit")).SendKeys(Keys.Enter); Thread.Sleep(7000); } else { driver.FindElement(By.Id("o_firstname")).SendKeys(lastname); driver.FindElement(By.Id("o_lastname")).SendKeys(firstname); gc.CreatePdf_WOP(orderNumber, "InputPassed_OwnerNameSearch", driver, "NV", "Washoe"); driver.FindElement(By.Name("ownsubmit")).SendKeys(Keys.Enter); Thread.Sleep(7000); } } catch { } try { IWebElement multi = driver.FindElement(By.XPath("//*[@id='search_results']")); multiparcel(orderNumber); HttpContext.Current.Session["multiParcel_NVWashoe"] = "Yes"; return("MultiParcel"); } catch { } } try { IWebElement INodata = driver.FindElement(By.Id("search_div")); if (INodata.Text.Contains("No results were found")) { HttpContext.Current.Session["Nodata_NVWashoe"] = "Yes"; driver.Quit(); return("No Data Found"); } } catch { } //APN: 078-221-13 outparcelno = driver.FindElement(By.XPath("//*[@id='search_div']/div[1]/div[5]/span[1]")).Text.Trim(); outparcelno = outparcelno.Replace("APN: ", ""); string outparcelnowoh = outparcelno.Replace("-", "").Trim(); gc.CreatePdf(orderNumber, outparcelnowoh, "AssessmentDetails", driver, "NV", "Washoe"); siteaddr = driver.FindElement(By.XPath("//*[@id='owner_data']/table/tbody/tr[1]/td[2]")).Text.Trim(); owner1 = driver.FindElement(By.XPath("//*[@id='owner_data']/table/tbody/tr[2]/td[2]")).Text.Trim(); //legal_desc = driver.FindElement(By.XPath("//*[@id='owner_data']/table/tbody/tr[8]/td[2]")).Text.Replace("'", "").Trim(); sub_div = driver.FindElement(By.XPath("//*[@id='owner_data']/table/tbody/tr[9]/td[2]")).Text.Replace("'", "").Trim(); year_built = driver.FindElement(By.XPath("//*[@id='building_data']/table/tbody/tr[3]/td[2]")).Text.Trim(); string property_details = siteaddr + "~" + owner1 + "~" + legal_desc + "~" + sub_div + "~" + year_built; gc.insert_date(orderNumber, outparcelno, 1, property_details, 1, DateTime.Now); //db.ExecuteQuery("insert into data_value_master (Order_no,parcel_no,Data_Field_Text_Id,Data_Field_value,Is_Table,Sequence) values ('" + orderNumber + "','" + outparcelno + "',1 ,'" + property_details + "',1,1)"); //db.ExecuteQuery("insert into real_property (orderno, apn, address,legal_description,subdivision,year_built,owner) values ('" + orderNumber + "', '" + outparcelno + "','" + siteaddr + "','" + legal_desc + "','" + sub_div + "','" + year_built + "','" + owner1 + "')"); //valuation Information IWebElement valuetableElement = driver.FindElement(By.XPath("//*[@id='value_data']/table")); IList <IWebElement> valuetableRow = valuetableElement.FindElements(By.TagName("tr")); IList <IWebElement> valuerowTD; List <string> history = new List <string>(); List <string> taxland = new List <string>(); List <string> taximprove = new List <string>(); List <string> taxtotal = new List <string>(); List <string> assessland = new List <string>(); List <string> assessimprove = new List <string>(); List <string> assesstotal = new List <string>(); int i = 0; foreach (IWebElement row in valuetableRow) { valuerowTD = row.FindElements(By.TagName("td")); if (valuerowTD.Count != 0) { if (i == 0) { history.Add(valuerowTD[1].Text.Trim().Replace("\r\n", "")); history.Add(valuerowTD[2].Text.Trim().Replace("\r\n", "")); } else if (i == 1) { taxland.Add(valuerowTD[1].Text); taxland.Add(valuerowTD[2].Text); } else if (i == 2) { taximprove.Add(valuerowTD[1].Text); taximprove.Add(valuerowTD[2].Text); } else if (i == 3) { taxtotal.Add(valuerowTD[1].Text); taxtotal.Add(valuerowTD[2].Text); } else if (i == 4) { assessland.Add(valuerowTD[1].Text); assessland.Add(valuerowTD[2].Text); } else if (i == 5) { assessimprove.Add(valuerowTD[1].Text); assessimprove.Add(valuerowTD[2].Text); } else if (i == 6) { assesstotal.Add(valuerowTD[1].Text); assesstotal.Add(valuerowTD[2].Text); } } i++; } string assessment1 = history[0] + "~" + taxland[0] + "~" + taximprove[0] + "~" + taxtotal[0] + "~" + assessland[0] + "~" + assessimprove[0] + "~" + assesstotal[0]; string assessment2 = history[1] + "~" + taxland[1] + "~" + taximprove[1] + "~" + taxtotal[1] + "~" + assessland[1] + "~" + assessimprove[1] + "~" + assesstotal[1]; gc.insert_date(orderNumber, outparcelno, 2, assessment1, 1, DateTime.Now); gc.insert_date(orderNumber, outparcelno, 2, assessment2, 1, DateTime.Now); AssessmentTime = DateTime.Now.ToString("HH:mm:ss"); //db.ExecuteQuery("insert into data_value_master (Order_no,parcel_no,Data_Field_Text_Id,Data_Field_value,Is_Table,Sequence) values ('" + orderNumber + "','" + outparcelno + "',2 ,'" + assessment1 + "',1,1)"); //db.ExecuteQuery("insert into data_value_master (Order_no,parcel_no,Data_Field_Text_Id,Data_Field_value,Is_Table,Sequence) values ('" + orderNumber + "','" + outparcelno + "',2 ,'" + assessment2 + "',1,1)"); //db.ExecuteQuery("insert into la_assessor(order_no,parcel_no,year,land,improvements,total,net_asses_value,tax_value,total_assessment) values('" + orderNumber + "','" + outparcelno + "','" + history[0] + "','" + taxland[0] + "','" + taximprove[0] + "','" + taxtotal[0] + "','" + assessland[0] + "','" + assessimprove[0] + "','" + assesstotal[0] + "') "); //db.ExecuteQuery("insert into la_assessor(order_no,parcel_no,year,land,improvements,total,net_asses_value,tax_value,total_assessment) values('" + orderNumber + "','" + outparcelno + "','" + history[1] + "','" + taxland[1] + "','" + taximprove[1] + "','" + taxtotal[1] + "','" + assessland[1] + "','" + assessimprove[1] + "','" + assesstotal[1] + "') "); //outparcelno = "035-310-41"; //Treasurer Details driver.Navigate().GoToUrl("https://nv-washoe-treasurer.manatron.com/Tabs/TaxSearch.aspx"); var ddlsearch = driver.FindElement(By.Id("selSearchBy")); var selectElement = new SelectElement(ddlsearch); selectElement.SelectByValue("Column1="); driver.FindElement(By.Id("fldInput")).SendKeys(outparcelnowoh); var wait = new WebDriverWait(driver, TimeSpan.FromMilliseconds(3000)); wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id='btnsearch']"))); gc.CreatePdf(orderNumber, outparcelnowoh, "InputPassed_Tax_ParcelSearch", driver, "NV", "Washoe"); driver.FindElement((By.XPath("//*[@id='btnsearch']"))).SendKeys(Keys.Enter); Thread.Sleep(3000); driver.FindElement(By.LinkText(outparcelnowoh)).SendKeys(Keys.Enter); Thread.Sleep(2000); gc.CreatePdf(orderNumber, outparcelnowoh, "Tax_MainPage", driver, "NV", "Washoe"); T_legal_desc = driver.FindElement(By.XPath("//*[@id='lxT528']/table/tbody/tr[5]/td")).Text; tax_authority = driver.FindElement(By.XPath("//*[@id='dnn_ctr480_HtmlModule_HtmlModule_lblContent']")).Text; tax_authority = gc.Between(tax_authority, "Mailing Address:", "Overnight Address:").Trim(); //db.ExecuteQuery("update real_property set legal_description ='" + legal_desc + "', tax_authority = '" + tax_authority + "' where orderno ='" + orderNumber + "' and apn = '" + outparcelno + "' "); property_details = siteaddr + "~" + owner1 + "~" + T_legal_desc + "~" + sub_div + "~" + year_built; //db.ExecuteQuery("insert into data_value_master (Order_no,parcel_no,Data_Field_Text_Id,Data_Field_value,Is_Table,Sequence) values ('" + orderNumber + "','" + outparcelno + "',1 ,'" + property_details + "',1,1)"); gc.insert_date(orderNumber, outparcelno, 1, property_details, 1, DateTime.Now); gc.CreatePdf(orderNumber, outparcelnowoh, "TaxBill_DetailsPage", driver, "NV", "Washoe"); //*[@id="529"]/table IWebElement taxbilltable = driver.FindElement(By.XPath("//*[@id='529']/table")); IList <IWebElement> taxbilltableRow = taxbilltable.FindElements(By.TagName("tr")); int rowcount = taxbilltableRow.Count; IList <IWebElement> taxbillrowTD; int w = 1; foreach (IWebElement rowid in taxbilltableRow) { taxbillrowTD = rowid.FindElements(By.TagName("td")); if (taxbillrowTD.Count != 0 && !rowid.Text.Contains("Tax Year")) { if (w < rowcount) { string cons = taxbillrowTD[0].Text + "~" + taxbillrowTD[1].Text + "~" + taxbillrowTD[2].Text + "~" + taxbillrowTD[3].Text + "~" + taxbillrowTD[4].Text + "~" + taxbillrowTD[5].Text; gc.insert_date(orderNumber, outparcelno, 66, cons, 1, DateTime.Now); } else { string cons = "-" + "~" + "-" + "~" + "-" + "~" + "-" + "~" + "Total" + "~" + taxbillrowTD[0].Text; gc.insert_date(orderNumber, outparcelno, 66, cons, 1, DateTime.Now); } } w++; } List <string> bill_year = new List <string>(); int l = 0; for (int m = 1; m < rowcount - 1; m++) { driver.FindElement(By.XPath("//*[@id='529']/table/tbody/tr[" + m + "]/td[1]/a")).SendKeys(Keys.Enter); Thread.Sleep(2000); //installments IWebElement inst1table = driver.FindElement(By.Id("installments")); IList <IWebElement> inst1tableRow = inst1table.FindElements(By.TagName("tr")); int inst1tableRowcount = inst1tableRow.Count; IList <IWebElement> inst1rowTD; int a = 0; string inst = ""; foreach (IWebElement rowid in inst1tableRow) { inst1rowTD = rowid.FindElements(By.TagName("td")); if (inst1rowTD.Count != 0) { if (a > 0 && a < inst1tableRowcount - 1) { //installment~due_date~tax_year~tax_amount~penalty_amount~Interest~total_due inst = inst1rowTD[0].Text + "~" + inst1rowTD[1].Text + "~" + inst1rowTD[2].Text + "~" + inst1rowTD[3].Text + "~" + inst1rowTD[4].Text + "~" + inst1rowTD[5].Text + "~" + inst1rowTD[6].Text; gc.insert_date(orderNumber, outparcelno, 3, inst, 1, DateTime.Now); } if (a == inst1tableRowcount - 1) { inst = " - " + "~" + " - " + "~" + inst1rowTD[0].Text + "~" + inst1rowTD[1].Text + "~" + inst1rowTD[2].Text + "~" + inst1rowTD[3].Text + "~" + inst1rowTD[4].Text; gc.insert_date(orderNumber, outparcelno, 3, inst, 1, DateTime.Now); } } a++; } try { //Payment History IWebElement payhisttable = driver.FindElement(By.XPath("//*[@id='lxT536']/table")); IList <IWebElement> payhisttableRow = payhisttable.FindElements(By.TagName("tr")); IList <IWebElement> payhistrowTD; foreach (IWebElement rowid1 in payhisttableRow) { payhistrowTD = rowid1.FindElements(By.TagName("td")); if (payhistrowTD.Count != 0) { string bill = payhistrowTD[0].Text + "~" + payhistrowTD[1].Text + "~" + payhistrowTD[2].Text + "~" + payhistrowTD[3].Text + "~" + payhistrowTD[4].Text; gc.insert_date(orderNumber, outparcelno, 4, bill, 1, DateTime.Now); } } } catch { } //Tax Detail //*[@id="lxT534"]/table //IList<IWebElement> breakdownslist = driver.FindElements(By.XPath("//*[@id='534_" + pathid + "]/div/table")); IWebElement taxdetailtable = driver.FindElement(By.XPath("//*[@id='lxT534']/table")); IList <IWebElement> taxdetailtableRow = taxdetailtable.FindElements(By.TagName("tr")); int taxrowcount = taxdetailtableRow.Count; IList <IWebElement> taxdetailrowTD; int b = 1; string tax_breakdown = ""; foreach (IWebElement rowid1 in taxdetailtableRow) { taxdetailrowTD = rowid1.FindElements(By.TagName("td")); if (taxdetailrowTD.Count != 0 && b <= taxrowcount) { if (b % 2 == 0 && b != taxrowcount) { if (l == 0) { pathid = driver.FindElement(By.XPath("//*[@id=\"lxT534\"]/table/tbody/tr[" + b + "]/td[1]")).GetAttribute("tb"); driver.FindElement(By.XPath("//*[@id='lxT534']/table/tbody/tr[" + b + "]/td[1]/a")).SendKeys(Keys.Enter); Thread.Sleep(2000); } tax_breakdown = taxdetailrowTD[0].Text + "~" + "-" + "~" + taxdetailrowTD[1].Text + "~" + taxdetailrowTD[2].Text + "~" + taxdetailrowTD[3].Text; gc.insert_date(orderNumber, outparcelno, 5, tax_breakdown, 1, DateTime.Now); //db.ExecuteQuery("insert into data_value_master (Order_no,parcel_no,Data_Field_Text_Id,Data_Field_value,Is_Table,Sequence) values ('" + orderNumber + "','" + outparcelno + "',5,'" + tax_breakdown + "',1,1)"); //db.ExecuteQuery("insert into tax_breakdown_details (order_no, parcel_no,tax_authority,gross_tax,credit,net_tax) values ('" + orderNumber + "', '" + outparcelno + "', '" + taxdetailrowTD[0].Text + "', '" + taxdetailrowTD[1].Text + "', '" + taxdetailrowTD[2].Text + "', '" + taxdetailrowTD[3].Text + "')"); } if (b == taxrowcount) { tax_breakdown = "Total Tax" + "~" + "-" + "~" + taxdetailrowTD[0].Text + "~" + taxdetailrowTD[1].Text + "~" + taxdetailrowTD[2].Text; gc.insert_date(orderNumber, outparcelno, 5, tax_breakdown, 1, DateTime.Now); // db.ExecuteQuery("insert into tax_breakdown_details (order_no, parcel_no,tax_authority,gross_tax,credit,net_tax) values ('" + orderNumber + "', '" + outparcelno + "', 'Total Tax','" + taxdetailrowTD[0].Text + "', '" + taxdetailrowTD[1].Text + "', '" + taxdetailrowTD[2].Text + "')"); } } b++; } if (l == 0) { gc.CreatePdf(orderNumber, outparcelnowoh, "Tax_HistoryDetailsPage", driver, "NV", "Washoe"); try { IWebElement newtable = driver.FindElement(By.XPath("//*[@id='534_" + pathid + " + 0']/div/table")); IList <IWebElement> newtableRow = newtable.FindElements(By.TagName("tr")); IList <IWebElement> newtablerowTD; int newtableRowcount = newtableRow.Count; foreach (IWebElement rowid1 in newtableRow) { newtablerowTD = rowid1.FindElements(By.TagName("td")); if (newtablerowTD.Count != 0 && !rowid1.Text.Contains("Authority")) { tax_breakdown = tax_breakdown = newtablerowTD[0].Text + "~" + newtablerowTD[1].Text + "~" + newtablerowTD[2].Text + "~" + newtablerowTD[3].Text + "~" + newtablerowTD[4].Text; gc.insert_date(orderNumber, outparcelno, 5, tax_breakdown, 1, DateTime.Now); //db.ExecuteQuery("insert into data_value_master (Order_no,parcel_no,Data_Field_Text_Id,Data_Field_value,Is_Table,Sequence) values ('" + orderNumber + "','" + outparcelno + "',5,'" + tax_breakdown + "',1,1)"); // db.ExecuteQuery("insert into tax_breakdown_details (order_no, parcel_no,tax_authority,net_rate,gross_tax,credit,net_tax) values ('" + orderNumber + "', '" + outparcelno + "', '" + newtablerowTD[0].Text + "', '" + newtablerowTD[1].Text + "', '" + newtablerowTD[2].Text + "', '" + newtablerowTD[3].Text + "', '" + newtablerowTD[4].Text + "')"); } } } catch { } for (int z = 300000; z <= 300070; z++) { string tableid = Convert.ToInt32(z).ToString(); string pathtdid = pathid + tableid; try { IWebElement commontable = driver.FindElement(By.XPath("//*[@id='534_" + pathtdid + "']/div/table")); IList <IWebElement> commontableRow = commontable.FindElements(By.TagName("tr")); IList <IWebElement> commontablerowTD; int commontableRowcount = commontableRow.Count; foreach (IWebElement rowid1 in commontableRow) { commontablerowTD = rowid1.FindElements(By.TagName("td")); if (commontablerowTD.Count != 0 && !rowid1.Text.Contains("Authority")) { tax_breakdown = commontablerowTD[0].Text + "~" + commontablerowTD[1].Text + "~" + commontablerowTD[2].Text + "~" + commontablerowTD[3].Text + "~" + commontablerowTD[4].Text; gc.insert_date(orderNumber, outparcelno, 5, tax_breakdown, 1, DateTime.Now); // db.ExecuteQuery("insert into data_value_master (Order_no,parcel_no,Data_Field_Text_Id,Data_Field_value,Is_Table,Sequence) values ('" + orderNumber + "','" + outparcelno + "',5,'" + tax_breakdown + "',1,1)"); //db.ExecuteQuery("insert into tax_breakdown_details (order_no, parcel_no,tax_authority,net_rate,gross_tax,credit,net_tax) values ('" + orderNumber + "', '" + outparcelno + "', '" + commontablerowTD[0].Text + "', '" + commontablerowTD[1].Text + "', '" + commontablerowTD[2].Text + "', '" + commontablerowTD[3].Text + "', '" + commontablerowTD[4].Text + "')"); } } } catch { } pathtdid = ""; } } l++; driver.Navigate().Back(); } TaxTime = DateTime.Now.ToString("HH:mm:ss"); // AMG Details string district_amgid = "-", amg_name = "-", status = "-", unbill_principal = "-", situs = "-", Legal_desc = "-", original_ass = "-", payoff = "-", due_desc = "-"; string curr_due_principal = "-", curr_due_interest = "-", curr_due_penalty = "-", curr_due_other = "-", curr_due_total_due = "-", amg_tax_authority = "-"; string ENI_principal = "-", ENI_interest = "-", ENI_penalty = "-", ENI_other = "-", ENI_total_due = "-"; string POB_Prepaid_principal = "-", POB_prepaid_interest = "-", POB_Prepay_Penalty = "-", POB_lien_reles = "-", POB_Curr_due = "-", POB_total_payoff = "-"; //string outparcelnowoh = "20808013"; // string outparcelnowoh = "03531041"; driver.Navigate().GoToUrl("https://www.amgnv.com/"); driver.FindElement(By.Name("Parcel")).SendKeys(outparcelnowoh); gc.CreatePdf(orderNumber, outparcelnowoh, "InputPassed_Amg_ParcelSearch", driver, "NV", "Washoe"); driver.FindElement(By.XPath("/html/body/table[3]/tbody/tr/td[6]/table/tbody/tr[2]/td[2]/p/table[2]/tbody/tr/td/table/tbody/tr[2]/td[1]/form/center/b/font/font/input")).SendKeys(Keys.Enter); Thread.Sleep(2000); gc.CreatePdf(orderNumber, outparcelnowoh, "Amg_MainPage", driver, "NV", "Washoe"); By amgfound = By.XPath("/html/body/table[3]/tbody/tr/td[6]/table/tbody/tr[2]/td[2]/p/table[2]/tbody/tr/td/b/font"); try { if (!Exists(amgfound)) { driver.FindElement(By.LinkText(outparcelnowoh)).SendKeys(Keys.Enter); Thread.Sleep(1000); gc.CreatePdf(orderNumber, outparcelnowoh, "Amg_DetailsPage", driver, "NV", "Washoe"); IWebElement amgdetailtable = driver.FindElement(By.XPath("/html/body/table[3]/tbody/tr/td[6]/table/tbody/tr[2]/td[2]/table[3]")); IList <IWebElement> amgdetailtableRow = amgdetailtable.FindElements(By.TagName("tr")); IList <IWebElement> amgdetailtablerowTD; foreach (IWebElement rowid1 in amgdetailtableRow) { amgdetailtablerowTD = rowid1.FindElements(By.TagName("td")); if (amgdetailtablerowTD.Count != 0 && !rowid1.Text.Contains("Parcel") && !rowid1.Text.Contains("Amounts")) { district_amgid = amgdetailtablerowTD[1].Text.Trim(); amg_name = amgdetailtablerowTD[2].Text.Trim(); unbill_principal = amgdetailtablerowTD[4].Text.Trim(); } } IWebElement situstable = driver.FindElement(By.XPath("/html/body/table[3]/tbody/tr/td[6]/table/tbody/tr[2]/td[2]/table[4]")); IList <IWebElement> situstableRow = situstable.FindElements(By.TagName("tr")); IList <IWebElement> situstablerowTD; int situsrowcount = situstableRow.Count; int s = 0; foreach (IWebElement rowid1 in situstableRow) { situstablerowTD = rowid1.FindElements(By.TagName("td")); if (situstablerowTD.Count != 0 && !rowid1.Text.Contains("Situs ") && s < situsrowcount - 1) { situs = situstablerowTD[0].Text.Replace(",", "").Trim(); original_ass = situstablerowTD[1].Text.Trim(); payoff = situstablerowTD[2].Text.Trim(); } if (s == situsrowcount - 1) { Legal_desc = situstablerowTD[0].Text.Trim(); } s++; } IWebElement duetable = driver.FindElement(By.XPath("/html/body/table[3]/tbody/tr/td[6]/table/tbody/tr[2]/td[2]/table[6]")); IList <IWebElement> duetableRow = duetable.FindElements(By.TagName("tr")); IList <IWebElement> duetablerowTD; int duerowcount = duetableRow.Count; int d = 0; foreach (IWebElement rowid1 in duetableRow) { duetablerowTD = rowid1.FindElements(By.TagName("td")); if (duetablerowTD.Count != 0 && !rowid1.Text.Contains("Principal") && d == 1) { curr_due_principal = duetablerowTD[1].Text.Trim(); curr_due_interest = duetablerowTD[2].Text.Trim(); curr_due_penalty = duetablerowTD[3].Text.Trim(); curr_due_other = duetablerowTD[4].Text.Trim(); curr_due_total_due = duetablerowTD[5].Text.Trim(); } if (d == 2) { ENI_principal = duetablerowTD[1].Text.Trim(); ENI_interest = duetablerowTD[2].Text.Trim(); ENI_penalty = duetablerowTD[3].Text.Trim(); ENI_other = duetablerowTD[4].Text.Trim(); ENI_total_due = duetablerowTD[5].Text.Trim(); } d++; } amg_tax_authority = driver.FindElement(By.XPath("/html/body/table[3]/tbody/tr/td[6]/table/tbody/tr[2]/td[2]/table[8]/tbody/tr[2]/td[2]/table/tbody/tr/td[2]")).Text; amg_tax_authority = amg_tax_authority.Replace("\n", ""); try { string currentHandle = driver.CurrentWindowHandle; IWebElement element = driver.FindElement(By.LinkText(payoff)); PopupWindowFinder finder = new PopupWindowFinder(driver); string popupWindowHandle = finder.Click(element); driver.SwitchTo().Window(popupWindowHandle); gc.CreatePdf(orderNumber, outparcelnowoh, "Amg_PayOffPage", driver, "NV", "Washoe"); IWebElement POBtable = driver.FindElement(By.XPath("/html/body/center/table[2]/tbody/tr/td/table")); IList <IWebElement> POBtableRow = POBtable.FindElements(By.TagName("tr")); //IList<IWebElement> POBtablerowTD; int POBrowcount = POBtableRow.Count; POB_Prepaid_principal = POBtableRow[1].Text.Replace("Prepaid Principal:", "").Trim(); POB_prepaid_interest = POBtableRow[2].Text.Replace("Prepaid Interest:", "").Trim(); POB_Prepay_Penalty = POBtableRow[3].Text.Replace("Prepayment Penalty:", "").Trim(); POB_lien_reles = POBtableRow[4].Text.Replace("Lien Release:", "").Trim();; POB_Curr_due = POBtableRow[5].Text.Replace("Current Due:", "").Trim(); POB_total_payoff = POBtableRow[6].Text.Replace("Total Payoff:", "").Trim(); string amgdetails = district_amgid + "~" + amg_name + "~" + situs + "~" + unbill_principal + "~" + Legal_desc + "~" + original_ass + "~" + payoff + "~" + curr_due_principal + "~" + curr_due_interest + "~" + curr_due_penalty + "~" + curr_due_other + "~" + curr_due_total_due + "~" + ENI_principal + "~" + ENI_interest + "~" + ENI_penalty + "~" + ENI_other + "~" + ENI_total_due + "~" + amg_tax_authority + "~" + POB_Prepaid_principal + "~" + POB_prepaid_interest + "~" + POB_Prepay_Penalty + "~" + POB_lien_reles + "~" + POB_Curr_due + "~" + POB_total_payoff; gc.insert_date(orderNumber, outparcelno, 6, amgdetails, 1, DateTime.Now); //db.ExecuteQuery("insert into data_value_master (Order_no,parcel_no,Data_Field_Text_Id,Data_Field_value,Is_Table,Sequence) values ('" + orderNumber + "','" + outparcelno + "',6,'" + amgdetails + "',1,1)"); // db.ExecuteQuery("insert into amg_details (order_no,parcel_no,District_amgid,Name,Situs,Unbill_prinicipal,Legaldescription,Original_Assesment,Payoff,curr_due_Principal,curr_due_Interest,curr_due_Penalty,curr_due_Other,curr_due_Total_Due,ENI_principal,ENI_interest,ENI_penalty,ENI_other,ENI_total_due,Tax_Authority,PayOff_Br_Prepaid_Principal,PayOff_Br_Prepaid_Interest,PayOff_Br_Prepayment_Penalty,PayOff_Br_Lien_Release,PayOff_Br_Current_Due,PayOff_Br_Total_Payoff) values ('" + orderNumber + "','" + parcelNumber + "','" + district_amgid + "','" + amg_name + "','" + situs + "','" + unbill_principal + "','" + Legal_desc + "','" + original_ass + "','" + payoff + "','" + curr_due_principal + "','" + curr_due_interest + "','" + curr_due_penalty + "','" + curr_due_other + "','" + curr_due_total_due + "','" + amg_tax_authority + "','" + ENI_principal + "','" + ENI_interest + "','" + ENI_penalty + "','" + ENI_other + "','" + ENI_total_due + "','" + POB_Prepaid_principal + "','" + POB_prepaid_interest + "','" + POB_Prepay_Penalty + "','" + POB_lien_reles + "','" + POB_Curr_due + "','" + POB_total_payoff + "')"); // Do whatever you need to on the popup browser, then... driver.Quit(); //driver.SwitchTo().Window(currentHandle); } catch { } } else { driver.Quit(); gc.mergpdf(orderNumber, "NV", "Washoe"); LastEndTime = DateTime.Now.ToString("HH:mm:ss"); gc.insert_TakenTime(orderNumber, "NV", "Washoe", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime); return("Data Inserted Successfully"); } } catch { } LastEndTime = DateTime.Now.ToString("HH:mm:ss"); driver.Quit(); gc.insert_TakenTime(orderNumber, "NV", "Washoe", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime); gc.mergpdf(orderNumber, "NV", "Washoe"); return("Data Inserted Successfully"); } catch (Exception ex) { driver.Quit(); GlobalClass.LogError(ex, orderNumber); throw ex; } } }
public void FecharPedido() { EnjoeatPageObject enjoeatPageObject = new EnjoeatPageObject(Driver); RestaurantPageObjects restaurantPageObjects = new RestaurantPageObjects(Driver); OrderPageObjects orderPageObjects = new OrderPageObjects(Driver); SumaryPageObjects sumaryPageObjects = new SumaryPageObjects(Driver); new BaseTest().AcessaUrl(Driver, "https://test-sandbox.azurewebsites.net/restaurants/"); enjoeatPageObject.IrparaRestaurante("Burger House").Click(); var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10)); wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img.box-img-detail"))); Assert.AreEqual("Burger House", enjoeatPageObject.NomeRestaurant.Text); for (int i = 0; i < 2; i++) { restaurantPageObjects.adicionarItemAoCarrinho("Classic Burger").Click(); } for (int i = 0; i < 2; i++) { restaurantPageObjects.adicionarItemAoCarrinho("Batatas fritas").Click(); } for (int i = 0; i < 3; i++) { restaurantPageObjects.adicionarItemAoCarrinho("Refrigerante").Click(); } Assert.AreEqual("R$ 61,50", restaurantPageObjects.TotalCarrinho.Text); wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10)); wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[class='box-footer']:last-child"))); restaurantPageObjects.BotaoConfirmar.Click(); orderPageObjects.CampoNome.SendKeys("Comprador teste"); orderPageObjects.CampoEmail.SendKeys("*****@*****.**"); orderPageObjects.CampoConfirmarEmail.SendKeys("*****@*****.**"); orderPageObjects.CampoEndereco.SendKeys("Rua Tal"); orderPageObjects.CampoNumero.SendKeys("123"); orderPageObjects.CampoComplemento.SendKeys("apto. 45"); IWebElement pagamentoItem = orderPageObjects.RetornarFormaDePagamento("Cartão de Débito"); pagamentoItem.FindElement(By.CssSelector("div")).Click(); Assert.AreEqual("Cartão de Débito", pagamentoItem.FindElement(By.CssSelector("label")).Text); Assert.AreEqual("R$ 61,50", orderPageObjects.RetornarPreco("Itens")); Assert.AreEqual("8,00", orderPageObjects.RetornarPreco("Frete").Replace("R$ ", "")); Assert.AreEqual("69,50", orderPageObjects.RetornarPreco("Valor Total").Replace("R$ ", "")); orderPageObjects.RemoverClassicBurguer.Click(); Assert.AreEqual("R$ 43,00", orderPageObjects.RetornarPreco("Itens")); Assert.AreEqual("8,00", orderPageObjects.RetornarPreco("Frete").Replace("R$ ", "")); Assert.AreEqual("51,00", orderPageObjects.RetornarPreco("Valor Total").Replace("R$ ", "")); orderPageObjects.FinalizarPedido.Click(); wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10)); wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("i.fa-star-o"))); Assert.AreEqual("Pedido foi Concluído", sumaryPageObjects.InformacaoConcluido.Text); Assert.AreEqual("Seu pedido foi recebido pelo restaurante. Prepare a mesa que a comida está chegando!", sumaryPageObjects.Mensagem.Text); sumaryPageObjects.AvaliarPedido(4).Click(); var verificaEstrela = sumaryPageObjects.VerificarAvaliacao(4); Assert.AreEqual(sumaryPageObjects.BuscarCor("Cinza"), verificaEstrela.GetCssValue("color")); }
static string GetNumberOfUnreadMessages(ChromeDriver chromeDriver)//method for getting number od unread messages in mail.ru account, takes ChromeDriver, returns string number { string idOfNumberContainer = "g_mail_events"; int timeoutInSeconds = 15; IWebElement numberContainer = new WebDriverWait(chromeDriver, TimeSpan.FromSeconds(timeoutInSeconds)).Until(ExpectedConditions.ElementIsVisible(By.Id(idOfNumberContainer))); string numberOfUnreadMessages = numberContainer.Text; chromeDriver.Quit(); return(numberOfUnreadMessages); }
public void WaitForDraftsListAppeared() { new WebDriverWait(Browser.GetDriver(), TimeSpan.FromSeconds(3)).Until( ExpectedConditions.ElementIsVisible(By.XPath(".//*[@class='AO']//*[@role ='main']"))); }
public void WaitForResult() { wait.Until(ExpectedConditions.ElementIsVisible(By.ClassName(resultClassName))); }
protected IWebElement GetVisibleWebElement(By by) { return(Wait.Until(ExpectedConditions.ElementIsVisible(by))); }
public void waitForElementByCssSelector(String cssSelector, int timeInSecond = -1) { timeInSecond = (timeInSecond == -1) ? waitingTime : timeInSecond; WebDriverWait wait = new WebDriverWait(seleDriver, TimeSpan.FromSeconds(timeInSecond)); IWebElement element = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(cssSelector))); }
private IWebElement TxtMessageBox() { WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(15)); return(wait.Until(ExpectedConditions.ElementIsVisible(By.Id("name")))); }
public void waitForElementByLinkText(String linkTest, int timeInSecond = -1) { timeInSecond = (timeInSecond == -1) ? waitingTime : timeInSecond; WebDriverWait wait = new WebDriverWait(seleDriver, TimeSpan.FromSeconds(timeInSecond)); IWebElement element = wait.Until(ExpectedConditions.ElementIsVisible(By.LinkText(linkTest))); }
public void Logout() { wait.Until(ExpectedConditions.ElementIsVisible(By.LinkText("Logout"))); System.Threading.Thread.Sleep(1000); driver.FindElement(By.LinkText("Logout")).Click(); }
private void ClickOnMenu(string menuLabel) { new WebDriverWait(webdriver, TimeSpan.FromSeconds(Constants.WAIT_TIME_DEFAULT)).Until(ExpectedConditions.ElementIsVisible(navigationContainer)); IList <IWebElement> menuList = webdriver.FindElements(By.CssSelector("div.sidemenu div.clickable")); foreach (IWebElement menuNow in menuList) { Console.WriteLine(menuNow.Text); if (menuNow.Text.ToLower().Contains(menuLabel.ToLower())) { menuNow.Click(); break; } } }
public IWebElement GetElement(By locator) { return(new WebDriverWait(this.driver, IMPLICITLY_GENERAL_WAIT_VISIBILITY_OF_ELEMENT_SEC) .Until(ExpectedConditions.ElementIsVisible(locator))); }
public void IsElementPresents(By by, TimeSpan timeout) { new WebDriverWait(Browser.Instanse.WebDriver, timeout).Until(ExpectedConditions.ElementIsVisible(by)); }
public void WaitForIsVisible() { new WebDriverWait(Browser.GetDriver(), TimeSpan.FromSeconds(Browser.TimeoutForElement)).Until(ExpectedConditions.ElementIsVisible(this.Locator)); }
public override void WaitUntilIsLoaded() { Wait.Until(ExpectedConditions.ElementIsVisible(root)); Wait.Until(ExpectedConditions.ElementIsVisible(primaryButton)); }
public void NewPrSubmissionByMake() { const string baseurl = "http://w3.dev.car.com"; _driver.Navigate().GoToUrl(baseurl); Assert.AreEqual(baseurl + "/", _driver.Url); WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(30)); System.Threading.Thread.Sleep(2000); // Click Research wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("a.hero-btn.one"))); Assert.IsTrue(_driver.FindElement(By.CssSelector("a.hero-btn.one")).GetAttribute("title").Equals("Research")); _driver.FindElement(By.CssSelector("a.hero-btn.one")).Click(); Assert.AreEqual(baseurl + "/car-research/", _driver.Url); System.Threading.Thread.Sleep(2000); // Click By Make wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("a.hero-btn.one"))); //Assert.IsTrue(_driver.FindElement(By.CssSelector("a.hero-btn.one")).GetAttribute("title").Equals("By Make")); _driver.FindElement(By.CssSelector("a.hero-btn.one")).Click(); Assert.AreNotEqual("0", _driver.Manage().Window.Position.Y); System.Threading.Thread.Sleep(2000); // Select Make - Honda // This method of navigating the site is used as this element does not take a .Click() event. var makemodeltrimurl = _driver.FindElement(By.CssSelector("a[href='/honda/']")).GetAttribute("href"); _driver.Navigate().GoToUrl(makemodeltrimurl); Assert.AreEqual(makemodeltrimurl, _driver.Url); System.Threading.Thread.Sleep(2000); // Select Model - Accord // This method of navigating the site is used as this element does not take a .Click() event. makemodeltrimurl = _driver.FindElement(By.CssSelector("a[href='/honda/accord/']")).GetAttribute("href"); _driver.Navigate().GoToUrl(makemodeltrimurl); Assert.AreEqual(makemodeltrimurl, _driver.Url); System.Threading.Thread.Sleep(2000); // Select Super Trim - Crosstourxv6 _driver.FindElement(By.Id("js-disablesupertrim-crosstourexv6")).Click(); Assert.IsTrue(_driver.FindElement(By.Id("overlayjs-trimcollection-crosstourexv6")).Displayed); System.Threading.Thread.Sleep(2000); // Select Real Trim - 2015 // This method of navigating the site is used as this element does not take a .Click() event. makemodeltrimurl = _driver.FindElement(By.CssSelector("a[href='/honda/accord/2015/crosstour-ex-v6-(a6)-fwd/']")).GetAttribute("href"); _driver.Navigate().GoToUrl(makemodeltrimurl); Assert.AreEqual(makemodeltrimurl, _driver.Url); System.Threading.Thread.Sleep(2000); // Click on Pricing & Offers _driver.FindElement(By.CssSelector("a.block.js_pricing_offers_init_btn")).Click(); Assert.IsTrue(_driver.FindElement(By.Id("js_side_panel")).GetAttribute("class").Equals("side-panel-container")); System.Threading.Thread.Sleep(2000); // Enter Zipcode // The wait is used here, to wait for the overlay to be ready. Otherwise it fails. wait.Until(ExpectedConditions.ElementIsVisible(By.Id("ncLeadZipcode"))); _driver.FindElement(By.Id("ncLeadZipcode")).SendKeys("99999"); Assert.IsTrue(_driver.FindElement(By.Id("ncLeadZipcode")).GetAttribute("value").Equals("99999")); System.Threading.Thread.Sleep(2000); // Click on Continue to Get Pricing _driver.FindElement(By.Id("GetDealersButton")).Click(); Assert.IsTrue(_driver.FindElement(By.Id("leadform_overlay_js")).Displayed); System.Threading.Thread.Sleep(2000); // Select a Dealer wait.Until((ExpectedConditions.ElementIsVisible(By.Id("147374^^1")))); Assert.IsTrue(_driver.FindElement(By.Id("147374^^1")).GetAttribute("checked").Equals("true")); System.Threading.Thread.Sleep(2000); // Enter First Name _driver.FindElement(By.Id("fName")).SendKeys("Bob"); System.Threading.Thread.Sleep(2000); // Enter Last Name _driver.FindElement(By.Id("lName")).SendKeys("Generic"); System.Threading.Thread.Sleep(2000); // Enter Street Address _driver.FindElement(By.Id("strAddr")).SendKeys("18872 MacArthur Blvd Suite 200"); System.Threading.Thread.Sleep(2000); // Enter Home Phone Area Code _driver.FindElement(By.Id("HParea")).SendKeys("949"); System.Threading.Thread.Sleep(2000); // Enter Home Phone Pre _driver.FindElement(By.Id("HPpre")).SendKeys("225"); System.Threading.Thread.Sleep(2000); // Enter Home Phone Phone _driver.FindElement(By.Id("HPphone")).SendKeys("4500"); System.Threading.Thread.Sleep(2000); // Enter Email Address _driver.FindElement(By.Id("email")).SendKeys("*****@*****.**"); System.Threading.Thread.Sleep(2000); // Click on Submit and Get Pricing _driver.FindElement(By.Id("SubmitPostButton")).Click(); System.Threading.Thread.Sleep(2000); // Get Confirmation Number Assert.IsTrue(_driver.FindElement(By.Id("prnumber_st")).Displayed); _confirmationNumber = _driver.FindElement(By.Id("prnumber_st")).Text; Console.WriteLine(_confirmationNumber); System.Threading.Thread.Sleep(5000); }
public IWebElement FindElement(By element) { WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); return(wait.Until(ExpectedConditions.ElementIsVisible(element))); }
public void Then首頁應顯示名稱(string name) { var element = _webDriver.Wait.Until(ExpectedConditions.ElementIsVisible(By.LinkText("Kelvin"))); Assert.AreEqual(name, element.Text); }
public bool StartConnectRequestFlow(List <LIUserConnectRequestReport> userConnects) { bool done = false; try { LIUserConnectRequestReport up = null; Logger.Debug($"{userConnects.Count} UserProfiles to process"); if (!isLoggedInToLinkedIn) { Logger.Debug($"Starting LinkedIn Login Workflow"); LoginToLinkedIn(); } for (int i = 0; i < userConnects.Count; i++) { try { string fm = string.Empty; if (i > 0) { ri = r.Next(_settings.ConnMinWait, _settings.ConnMaxWait); int w = ri * 1000; Logger.Debug($"Sleeping for {ri} Seconds before next Connection Request"); Thread.Sleep(w); } up = userConnects[i]; Logger.Debug($"Processing UserProfile No. {(i + 1)} - {up.ProfileTitle} - {up.ProfileUrl}"); Logger.Debug($"Navigating to UserProfile {up.ProfileTitle}"); NavigateToUrl(up.ProfileUrl); LongRandomWait(); DoAjaxWait(); Logger.Debug($"Checking existence of Connect Button"); var btnConnect = _driver.FindElements(By.CssSelector(LIConnectionRequestSelectors.ProfileConnButtonCSSSel)); if (btnConnect == null || btnConnect.Count <= 0) { Logger.Debug($"No Connect Button found for Profile {up.ProfileTitle}, URL=> {up.ProfileUrl}"); up.Comments = "No Connect Button found for Profile" + Environment.NewLine; continue;; } Logger.Debug($"Clicking Connect Button"); btnConnect[0].Click(); ShortRandomWait(); Logger.Debug("Waiting for Connection ActionBar to appear"); _wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(LIConnectionRequestSelectors.SendConnectDivVisibleCSSSel))); var btnAddNote = _driver.FindElements(By.CssSelector(LIConnectionRequestSelectors.ConnAddNoteButtonCSSSel)); bool addNote = true; if (btnAddNote == null || btnAddNote.Count <= 0) { Logger.Debug($"No Add Note Button for Profile {up.ProfileTitle}, URL=> {up.ProfileUrl}"); up.Comments = "No Add Note Button for Profile" + Environment.NewLine;; Logger.Debug($"Trying Sending Connect Request without Note"); addNote = false; } if (addNote) { if (!string.IsNullOrWhiteSpace(_settings.ConnGreetings) || !string.IsNullOrWhiteSpace(_settings.ConnMessage)) { var tp = _util.GetGreetingAndMessage(up, _settings, _settings.ConnGreetings, _settings.ConnMessage); if (!string.IsNullOrWhiteSpace(tp.Item1)) { fm = tp.Item1 + System.Environment.NewLine; } if (!string.IsNullOrWhiteSpace(tp.Item2)) { fm += tp.Item2; } Logger.Debug($"Adding Connection Message {fm}"); Logger.Debug($"Clicking Add Note Button"); btnAddNote[0].Click(); ShortRandomWait(); _driver.FindElement(By.CssSelector(LIConnectionRequestSelectors.ConnNoteTextCSSSel)).SendKeys(fm); } else { Logger.Debug($"No Greetings or Message found to send"); up.Comments = "No Greetings or Message found to send" + Environment.NewLine;; } } Logger.Debug($"Sending Connection Request"); _driver.FindElement(By.CssSelector(LIConnectionRequestSelectors.ConnSendDoneButtonCSSSel)).Click(); ShortRandomWait(); DoAjaxWait(); up.ConnectMessage = fm; up.Timestamp = DateTime.Now; } catch (Exception ex) { up.Timestamp = DateTime.Now; up.Errors = ex.Message; Logger.Error(ex, $"Inside-Loop-{i+1}: Error while making Connection Request to User {up.ProfileTitle} - {up.ProfileUrl}"); } } done = true; Logger.Debug("All Connection Message Requests have been processed"); } catch (Exception ex) { Logger.Error(ex, "Error while Connection Request Flow"); } return(done); }