private void OpenDoc(IWebElement Doc, documentType doctype) //open documents online { // wait.Until(e => Doc.Displayed); currentdocTitle = Doc.Text; //DocumentCheckbox.Click(); // MoreOptions.Click(); action.ContextClick(Doc).Perform(); finder = new PopupWindowFinder(SeleniumDriver.Instance); popupWindowHandle = finder.Click(OpenDocumentIn(doctype)); // OpenDocumentIn(doctype).Click(); // action.Click(OpenDocumentIn(doctype)).Perform(); // SeleniumDriver.Instance.FindElements(By.TagName("li")).Single(e => e.Text.Equals("Open in " + doctype.ToString() + " Online")).Click(); wait.Until(e => SeleniumDriver.Instance.WindowHandles.Count >= 2); SeleniumDriver.Close(); SeleniumDriver.Instance.SwitchTo().Window(popupWindowHandle); SeleniumDriver.Instance.Manage().Window.Maximize(); Console.WriteLine(doctype.ToString() + " Document opened Succesfully"); Console.Write("</br>"); }
public void Desktop_e2e_login_test() { var appiumOptions = new OpenQA.Selenium.Appium.AppiumOptions(); appiumOptions.AddAdditionalCapability("app", @"C:\Users\9i9i\source\repos\MailSystemDesktopApp\MailSystemDesktopApp\bin\Debug\net5.0-windows\MailSystemDesktopApp.exe"); var applicationSession = new WindowsDriver <WindowsElement>(new Uri("http://127.0.0.1:4723"), appiumOptions); applicationSession.FindElementByName("loginTextBox").SendKeys("admin"); applicationSession.FindElementByName("passwordTextBox").SendKeys("admin"); //applicationSession.FindElementByClassName("Button").Click(); string current = applicationSession.CurrentWindowHandle; PopupWindowFinder finder = new PopupWindowFinder(applicationSession); string newHandle = finder.Click(applicationSession.FindElementByClassName("Button")); applicationSession.SwitchTo().Window(newHandle); applicationSession.FindElementByName("titleTextBox").SendKeys("test"); var testText = applicationSession.FindElementByName("titleTextBox").Text; Assert.IsNotNull(testText); }
public Boolean LoopThorughAllFLowsAndRun() { this.Execute("JobOrders", driver => { Thread.Sleep(3000); int count = driver.FindElements(By.XPath("//div[normalize-space(text())='Off']/../..//a")).Count(); for (int i = 0; i < count; i++) { var ele = driver.FindAvailable(By.XPath($"(//div[normalize-space(text())='Off']/../..//a)[{i + 1}]")); var popup = new PopupWindowFinder(driver); string session = popup.Click(ele); driver.SwitchTo().Window(session); string result = TurnOn() == true ? "is turned On" : "is not turned On"; Console.WriteLine(ele.Text + " => " + result); driver.Close(); } return(true); }); return(true); }
public ORS_DocumentDownloadPopUpWindow clickPDFLink() { // Get the current window handle so you can switch back later. string currentHandle = driver.CurrentWindowHandle; // The Click method of the PopupWindowFinder class will click // the desired element, wait for the popup to appear, and return // the window handle to the popped-up browser window. Note that // you still need to switch to the window to manipulate the page // displayed by the popup window. PopupWindowFinder finder = new PopupWindowFinder(driver); string popupWindowHandle = finder.Click(PDFLink); driver.SwitchTo().Window(popupWindowHandle); // Do whatever you need to on the popup browser, then... //driver.Close(); //driver.SwitchTo().Window(currentHandle); return(new ORS_DocumentDownloadPopUpWindow(driver, currentHandle)); }
//This will switch and close new pop up window public static void ClosePopUpWindow(this IWebDriver driver, IWebElement element) { // Get the current window handle so you can switch back later. string currentHandle = driver.CurrentWindowHandle; // Find the element that triggers the popup when clicked on. element = driver.FindElement(By.XPath("//*[@id='webtraffic_popup_start_button']")); // The Click method of the PopupWindowFinder class will click // the desired element, wait for the popup to appear, and return // the window handle to the popped-up browser window. Note that // you still need to switch to the window to manipulate the page // displayed by the popup window. PopupWindowFinder finder = new PopupWindowFinder(driver); string popupWindowHandle = finder.Click(element); driver.SwitchTo().Window(popupWindowHandle); // Do whatever you need to on the popup browser, then... driver.Close(); driver.SwitchTo().Window(currentHandle); }
/// <summary> /// Fetch the download link of the desired update by using the Selenium Chrome driver (a Chrome installation in the default directory is needed). Will use a user set custom Chromium binary if the flag is set to true. /// </summary> /// <param name="searchUrl">Url of the starting website.</param> /// <param name="htmlID">Unique HTML ID of the specific update (e.g. 26896846-497d-4755-893a-6870f72ddcf4). This is only exposed in the HTML source code, however it is usable as a search parameter for the Microsoft Update Catalog</param> /// <param name="useCustomChromiumBinary">Use user set custom Chromium binary</param> /// <returns>Direct download link to the specific update.</returns> private string FetchDownloadLinkChrome(string searchUrl, string htmlID, bool useCustomChromiumBinary) { ChromeDriverService driverService = ChromeDriverService.CreateDefaultService(); driverService.HideCommandPromptWindow = true; ChromeOptions options = new ChromeOptions(); options.AddArguments("--headless"); options.AddArguments("--proxy-server='direct://'"); options.AddArguments("--proxy-bypass-list=*"); options.AddArguments("--disable-gpu"); if (useCustomChromiumBinary) { options.BinaryLocation = chromiumTextBox.Text; } IWebDriver driver = new ChromeDriver(driverService, options); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); driver.Navigate().GoToUrl(searchUrl); IWebElement test = driver.FindElement(By.XPath($"//input[@id='{htmlID}' and @value='Download']")); PopupWindowFinder finder = new PopupWindowFinder(driver); string popupWindowHandle = finder.Click(test); driver.SwitchTo().Window(popupWindowHandle); ReadOnlyCollection <IWebElement> downloadLinkElements = driver.FindElements(By.PartialLinkText("")); foreach (IWebElement downloadLinkElement in downloadLinkElements) { string downloadLink = downloadLinkElement.GetAttribute("href"); if (downloadLink.EndsWith(".msu")) { driver.Quit(); return(downloadLink); } } return(null); }
public Boolean PerformActionOnElement(IWebElement WebElement, string ElementAction) { //Console.WriteLine("--" + ElementParameter); string[] PageElement = ElementAction.Split('='); switch (PageElement[0]) { case "SendKeys": if (PageElement[1] == "Tab") { WebElement.SendKeys(OpenQA.Selenium.Keys.Tab); } else if (PageElement[1] == "Enter") { WebElement.SendKeys(OpenQA.Selenium.Keys.Enter); } else { WebElement.Clear(); WebElement.SendKeys("" + PageElement[1] + ""); } break; case "select": int number; if (Int32.TryParse(PageElement[1], out number)) { new SelectElement(WebElement).SelectByIndex(number); } else { new SelectElement(WebElement).SelectByText("" + PageElement[1] + ""); } break; case "click": WebElement.Click(); //((IJavaScriptExecutor)driver).ExecuteScript("return document.readyState").Equals("complete"); break; case "clickPopUp": ParentWindow = driver.CurrentWindowHandle; PopupWindowFinder finder = new PopupWindowFinder(driver); string newHandle = finder.Click(WebElement); driver.SwitchTo().Window(newHandle); break; case "closePopup": if (ParentWindow != driver.CurrentWindowHandle) { driver.Close(); driver.SwitchTo().Window(ParentWindow); } break; case "switch": //if (ParentWindow != driver.CurrentWindowHandle) //{ driver.SwitchTo().Window(ParentWindow); //} break; case "alert": Thread.Sleep(3000); if (PageElement[1] == "accept") { driver.SwitchTo().Alert().Accept(); } else { driver.SwitchTo().Alert().Dismiss(); } Thread.Sleep(1000); break; case "hover": Actions action = new Actions(driver); action.MoveToElement(WebElement).Perform(); break; case "scroll": //((IJavaScriptExecutor)driver).ExecuteScript("window.scrollTo(0, document.body.scrollHeight - 150)"); ((IJavaScriptExecutor)driver).ExecuteScript("setInterval(function () { window.scroll(0, document.height); }, 100)"); break; case "Wait": Thread.Sleep(1000); break; case "FileUpload": WebElement.Click(); Thread.Sleep(2000); SendKeys.SendWait(PageElement[1]); SendKeys.SendWait(@"{Enter}"); break; case "type": if (WebElement.GetAttribute("type") != PageElement[1]) { return(false); } break; case "width": if (WebElement.GetAttribute("width") != PageElement[1]) { return(false); } break; case "height": if (WebElement.GetAttribute("height") != PageElement[1]) { return(false); } break; //Textbox case "Required": WebElement.Clear(); driver.FindElement(By.CssSelector("input[value='" + PageElement[1] + "']")).Click(); return(true); case "Numeric": WebElement.SendKeys("1234"); driver.FindElement(By.CssSelector("input[value='" + PageElement[1] + "']")).Click(); //The page is refreshed and the elements cannot be idenfied after submit //WebElement.Submit(); break; case "AlphaNumeric": WebElement.SendKeys("Abc@123"); driver.FindElement(By.CssSelector("input[value='" + PageElement[1] + "']")).Click(); return(true); //The page is refreshed and the elements cannot be idenfied after submit //WebElement.Submit(); //Dropdown case "RequireSelection": new SelectElement(WebElement).SelectByIndex(0); driver.FindElement(By.CssSelector("input[value='" + PageElement[1] + "']")).Click(); return(true); } return(true); }
public string FTP_Forsyth(string streetno, string direction, string streetname, string streetype, string unitno, string ownername, string parcelNumber, string searchType, string orderNumber, string directParcel) { GlobalClass.global_orderNo = orderNumber; HttpContext.Current.Session["orderNo"] = orderNumber; GlobalClass.global_parcelNo = parcelNumber; List <string> multiparcel = new List <string>(); string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = ""; var driverService = PhantomJSDriverService.CreateDefaultService(); driverService.HideCommandPromptWindow = true; using (driver = new PhantomJSDriver()) { StartTime = DateTime.Now.ToString("HH:mm:ss"); driver.Navigate().GoToUrl("http://tellus.co.forsyth.nc.us/lrcpwa/SearchProperty.aspx"); Thread.Sleep(2000); try { if (searchType == "titleflex") { string address = streetno + " " + direction + " " + streetname + " " + streetype + " " + unitno; gc.TitleFlexSearch(orderNumber, parcelNumber, "", address, "NC", "Forsyth"); 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_NCForsyth"] = "Yes"; driver.Quit(); return("No Data Found"); } parcelNumber = HttpContext.Current.Session["titleparcel"].ToString(); searchType = "parcel"; } if (searchType == "address") { driver.FindElement(By.XPath("//*[@id='panelSummary']/li[2]/a")).SendKeys(Keys.Enter); Thread.Sleep(2000); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetNumberTextBox")).SendKeys(streetno); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetNameTextBox")).SendKeys(streetname); gc.CreatePdf_WOP(orderNumber, "SearchAddressBefore", driver, "NC", "Forsyth"); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_AddressButton")).SendKeys(Keys.Enter); gc.CreatePdf_WOP(orderNumber, "SearchAddressAfter", driver, "NC", "Forsyth"); Thread.Sleep(2000); string mul = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text; mul = WebDriverTest.Before(mul, "Records").Trim(); int i, j = 2; if ((mul != "1") && (mul != "0")) { int iRowsCount = driver.FindElements(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView']/tbody/tr")).Count; for (i = 2; i <= iRowsCount; i++) { if (j >= 2 && i != 2) { IWebElement checkbox1 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView_ctl0" + j + "_CheckBox1']")); // checkbox.Clear(); checkbox1.Click(); Thread.Sleep(1000); j++; } IWebElement checkbox = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView_ctl0" + i + "_CheckBox1']")); // checkbox.Clear(); checkbox.Click(); Thread.Sleep(1000); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetDictionarySearchButton")).SendKeys(Keys.Enter); Thread.Sleep(1000); string mul1 = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text; mul1 = GlobalClass.Before(mul1, " Records Matched Search Criteria").Trim(); int count = Convert.ToInt32(mul1); if (count > 0) { //multi parcel gc.CreatePdf_WOP(orderNumber, "Multiparcel Result", driver, "NC", "Forsyth"); IWebElement tbmulti2 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody")); IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr")); IList <IWebElement> TDmulti2; int rescount = TRmulti2.Count; foreach (IWebElement row in TRmulti2) { TDmulti2 = row.FindElements(By.TagName("td")); if (TDmulti2.Count != 0 && TDmulti2[1].Text.Trim() != "" && !row.Text.Contains("Pfx") && TDmulti2.Count == 9) { IWebElement multiparcellink = TDmulti2[0].FindElement(By.TagName("a")); string strmulti = multiparcellink.GetAttribute("href"); multiparcel.Add(strmulti); string multi1 = TDmulti2[1].Text + " " + TDmulti2[4].Text + "~" + TDmulti2[8].Text; if (TDmulti2[1].Text == streetno || streetno == "0") { gc.insert_date(orderNumber, TDmulti2[0].Text, 616, multi1, 1, DateTime.Now); } // Owner~address } } } driver.Navigate().Back(); Thread.Sleep(1000); } if (multiparcel.Count > 1) { HttpContext.Current.Session["multiparcel_Forsyth"] = "Yes"; driver.Quit(); return("MultiParcel"); } else { foreach (string real in multiparcel) { driver.Navigate().GoToUrl(real); Thread.Sleep(4000); } } } else { try { driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter); Thread.Sleep(2000); } catch { } } try { //No Data Found string nodata = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text; if (nodata.Contains("0 Records Matched Search Criteria")) { HttpContext.Current.Session["Nodata_NCForsyth"] = "Yes"; driver.Quit(); return("No Data Found"); } } catch { } } if (searchType == "parcel") { driver.FindElement(By.XPath("//*[@id='panelSummary']/li[4]/a")).Click(); Thread.Sleep(4000); IWebElement text = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_PINNumberTextBox']")); parcelNumber = parcelNumber.Replace("-", ""); text.Clear(); IWebElement add = driver.FindElement(By.XPath("//*[@id='PIN']/div/div/div/center/table/tbody/tr[2]/td/div/div")); IList <IWebElement> MultiOwnerRow = add.FindElements(By.TagName("input")); foreach (IWebElement row1 in MultiOwnerRow) { row1.SendKeys(parcelNumber); } gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search Input Passed", driver, "NC", "Forsyth"); // text.SendKeys(parcelNumber); driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_PinButton']")).Click(); Thread.Sleep(3000); gc.CreatePdf_WOP(orderNumber, "Parcel Search Result", driver, "NC", "Forsyth"); try { //No Data Found string nodata = driver.FindElement(By.Id("ctl00_PageHeader1_ErrorMessageLabel")).Text; if (nodata.Contains("No Records Found")) { HttpContext.Current.Session["Nodata_NCForsyth"] = "Yes"; driver.Quit(); return("No Data Found"); } } catch { } } if (searchType == "ownername") { string firstname = "", lastname = ""; if (ownername.Contains(' ')) { string[] name = ownername.Split(' '); firstname = name[0]; lastname = name[1]; if (!ownername.Contains(',')) { ownername = firstname + "," + lastname; } } driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_OwnerTextBox']")).SendKeys(ownername); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_OwnerButton")).SendKeys(Keys.Enter); Thread.Sleep(2000); string mul = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text; mul = WebDriverTest.Before(mul, "Records").Trim(); if ((mul != "1") && (mul != "0")) { //multi parcel gc.CreatePdf_WOP(orderNumber, "Multiparcel Result", driver, "NC", "Forsyth"); IWebElement tbmulti = driver.FindElement(By.XPath(" //*[@id='ctl00_ContentPlaceHolder1_OwnerSearchResultsGridView']/tbody")); IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr")); int TRmulticount = TRmulti.Count; int maxCheck = 0; IList <IWebElement> TDmulti; foreach (IWebElement row in TRmulti) { if (maxCheck <= 25) { TDmulti = row.FindElements(By.TagName("td")); if (TDmulti.Count != 0) { if (maxCheck <= 15) { string multi1 = TDmulti[3].Text + "~" + TDmulti[2].Text; gc.insert_date(orderNumber, TDmulti[1].Text, 616, multi1, 1, DateTime.Now); } } maxCheck++; } } if (TRmulti.Count > 25) { HttpContext.Current.Session["multiParcel_Forsyth_Multicount"] = "Maximum"; driver.Quit(); return("Maximum"); } else { HttpContext.Current.Session["multiparcel_Forsyth"] = "Yes"; } driver.Quit(); return("MultiParcel"); } try { //No Data Found string nodata = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text; if (nodata.Contains("0 Records Matched Search Criteria")) { HttpContext.Current.Session["Nodata_NCForsyth"] = "Yes"; driver.Quit(); return("No Data Found"); } } catch { } } //Property Details string TaxYear = "", REID = "", ParcelID = "", PropertyOwner = "", PropertyAddress = "", LegalDescription = "", MailingAddress = "", OldMapNumber = "", MarketArea = "", Township = "", PlanningJurisdiction = "", City = "", FireDistrict = "", SpecialDistrict = "", PropertyClass = "", YearBuilt = ""; //driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter); //Thread.Sleep(2000); string propbulktext = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div[1]/div/div/div[2]/div[1]/div[1]/table/tbody/tr[1]/td/table")).Text; TaxYear = driver.FindElement(By.Id("ctl00_PageHeader1_TaxYear")).Text; REID = driver.FindElement(By.Id("ctl00_PageHeader1_ReidLabelInfo")).Text; ParcelID = driver.FindElement(By.Id("ctl00_PageHeader1_PinLabelInfo")).Text; PropertyOwner = driver.FindElement(By.XPath("//*[@id='ctl00_PageHeader1_DetailsView1']/tbody/tr/td")).Text; PropertyAddress = driver.FindElement(By.Id("ctl00_PageHeader1_LocationAddressLabelInfo")).Text; LegalDescription = driver.FindElement(By.Id("ctl00_PageHeader1_PropertyDescriptionLabelInfo")).Text; MailingAddress = driver.FindElement(By.Id("ctl00_PageHeader1_DetailsView4")).Text.Replace("\r\n", " ").Trim(); gc.CreatePdf(orderNumber, ParcelID, "Property and Assessment Details", driver, "NC", "Forsyth"); string bulktext = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_DetailsView5")).Text; OldMapNumber = gc.Between(bulktext, "Old Map# ", "Market Area ").Trim(); MarketArea = gc.Between(bulktext, "Market Area ", "Township ").Trim(); Township = gc.Between(bulktext, "Township ", "Planning Jurisdiction").Trim(); PlanningJurisdiction = gc.Between(bulktext, "Planning Jurisdiction", "City").Trim(); City = gc.Between(bulktext, "City", "Fire District").Trim(); FireDistrict = gc.Between(bulktext, "Fire District", "Spec District").Trim(); SpecialDistrict = gc.Between(bulktext, "Spec District", "Land Class").Trim(); PropertyClass = gc.Between(bulktext, "Land Class", "History REID 1").Replace("\r\n", " ").Trim(); driver.FindElement(By.Id("ctl00_PageHeader1_BuildingsHyperLink")).SendKeys(Keys.Enter); Thread.Sleep(2000); gc.CreatePdf(orderNumber, ParcelID, "Building Details", driver, "NC", "Forsyth"); string yearbuilt = ""; try { yearbuilt = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_DetailsView4")).Text; YearBuilt = gc.Between(yearbuilt, "Year Built", "Additions").Replace("\r\n", "").Trim(); } catch { } string propertydetails = TaxYear + "~" + REID + "~" + PropertyOwner + "~" + PropertyAddress + "~" + LegalDescription + "~" + MailingAddress + "~" + OldMapNumber + "~" + MarketArea + "~" + Township + "~" + PlanningJurisdiction + "~" + City + "~" + FireDistrict + "~" + SpecialDistrict + "~" + PropertyClass + "~" + YearBuilt; gc.insert_date(orderNumber, ParcelID, 603, propertydetails, 1, DateTime.Now); //Assessment Details string currentHandle = driver.CurrentWindowHandle; IWebElement element = driver.FindElement(By.LinkText("Print Property Info")); PopupWindowFinder finder = new PopupWindowFinder(driver); string popupWindowHandle = finder.Click(element); driver.SwitchTo().Window(popupWindowHandle); gc.CreatePdf(orderNumber, ParcelID, "Assessment Details", driver, "NC", "Forsyth"); Thread.Sleep(3000); IWebElement asstableElement = driver.FindElement(By.XPath("//*[@id='headerPlaceholder']/div/div[4]/div/table/tbody")); IList <IWebElement> asstableElementRow = asstableElement.FindElements(By.TagName("tr")); IList <IWebElement> asstableElementRowTD; IList <IWebElement> asstableElementRowTH; var assesscolumn = ""; var assessvalue = ""; foreach (IWebElement rowid in asstableElementRow) { asstableElementRowTD = rowid.FindElements(By.TagName("td")); asstableElementRowTH = rowid.FindElements(By.TagName("th")); if (asstableElementRowTD.Count != 0 && !rowid.Text.Contains("Property Value") && rowid.Text != "") { if (asstableElementRowTD[0].Text != " ") { assesscolumn += asstableElementRowTH[0].Text + "~"; assessvalue += asstableElementRowTD[0].Text + "~"; } } } assesscolumn = assesscolumn.TrimEnd('~'); assessvalue = assessvalue.TrimEnd('~'); DBconnection dbconn = new DBconnection(); dbconn.ExecuteQuery("update data_field_master set Data_Fields_Text='" + assesscolumn + "' where Id = '" + 605 + "'"); gc.insert_date(orderNumber, ParcelID, 605, assessvalue, 1, DateTime.Now); AssessmentTime = DateTime.Now.ToString("HH:mm:ss"); //Tax Information Details driver.Navigate().GoToUrl("http://tellus.co.forsyth.nc.us/PublicWebAccess/BillSearchResults.aspx?"); Thread.Sleep(2000); string Par = ".000"; parcelNumber = ParcelID + Par; IWebElement ISelect = driver.FindElement(By.Id("lookupCriterion")); SelectElement sSelect = new SelectElement(ISelect); sSelect.SelectByText("Parcel Number"); driver.FindElement(By.Id("txtSearchString")).SendKeys(parcelNumber); gc.CreatePdf(orderNumber, ParcelID, "Tax Search Input Passed", driver, "NC", "Forsyth"); driver.FindElement(By.XPath("//*[@id='btnGo']")).SendKeys(Keys.Enter); Thread.Sleep(2000); gc.CreatePdf(orderNumber, ParcelID, "Tax Search Result", driver, "NC", "Forsyth"); //Tax Histry Details IWebElement tdHistry = driver.FindElement(By.XPath("//*[@id='tblSearchResults']")); IList <IWebElement> TrHistry = tdHistry.FindElements(By.TagName("tr")); IList <IWebElement> TDHistry; IList <IWebElement> TDHistryth; foreach (IWebElement row in TrHistry) { TDHistry = row.FindElements(By.TagName("td")); TDHistryth = row.FindElements(By.TagName("tr")); if (!row.Text.Contains("Bill #")) { if (TDHistry.Count == 7) { string TaxHistryDetails = TDHistry[0].Text + "~" + TDHistry[1].Text + "~" + TDHistry[2].Text + "~" + TDHistry[3].Text + "~" + TDHistry[4].Text + "~" + TDHistry[5].Text + "~" + TDHistry[6].Text; gc.insert_date(orderNumber, ParcelID, 612, TaxHistryDetails, 1, DateTime.Now); } else if (row.Text.Contains("Total")) { string total = GlobalClass.After(row.Text, "Total:"); string TaxHistryDetails = "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "Total" + "~" + total; gc.insert_date(orderNumber, ParcelID, 612, TaxHistryDetails, 1, DateTime.Now); } } } List <string> strTaxRealestate = new List <string>(); try { IWebElement ITaxinfoDetails = driver.FindElement(By.XPath("//*[@id='G_dgResults']/tbody")); IList <IWebElement> ITaxinfoRealRow = ITaxinfoDetails.FindElements(By.TagName("tr")); IList <IWebElement> ITaxinfoRealTd; foreach (IWebElement ItaxinfoReal in ITaxinfoRealRow) { ITaxinfoRealTd = ItaxinfoReal.FindElements(By.TagName("td")); if (ITaxinfoRealTd.Count != 0 && strTaxRealestate.Count < 3) { IWebElement ITaxBillCount = ITaxinfoRealTd[0].FindElement(By.TagName("a")); string strTaxReal = ITaxBillCount.GetAttribute("href"); strTaxRealestate.Add(strTaxReal); } } } catch { } foreach (string real in strTaxRealestate) { string TaxMailingAddress = "", RealValue = "", DeferredValue = "", UseValue = "", PersonalValue = "", ExemptExclusion = "", TotalAssessedValue = "", BillTaxYear = "", PropertyTax = "", BillStatus = "", BillFlag = "", BillNumber = "", OldBillNumber = "", OldAccountNumber = "", DueDate = "", InterestBegins = "" , InterestAmount = "", TotalBilled = "", GoodThroughDate = "", LastPaymentDate = "", CurrentDue = "", TaxAuthority = "", DiscountPeriod = ""; driver.Navigate().GoToUrl(real); Thread.Sleep(4000); if (strTaxRealestate.Count != 0 && strTaxRealestate.Count == 3) { try { BillFlag = driver.FindElement(By.Id("lblBillFlag")).Text; if (BillFlag.Contains("DELINQUENT")) { IWebElement dt = driver.FindElement(By.Id("interestCalDate_input")); string date = dt.GetAttribute("value"); DateTime G_Date = Convert.ToDateTime(date); string dateChecking = DateTime.Now.ToString("MM") + "/15/" + DateTime.Now.ToString("yyyy"); if (G_Date < Convert.ToDateTime(dateChecking)) { //end of the month date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")))).ToString("MM/dd/yyyy"); } else if (G_Date > Convert.ToDateTime(dateChecking)) { // nextEndOfMonth if ((Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM"))) < 12)) { date = new DateTime(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(Convert.ToInt16(DateTime.Now.ToString("MM")) + 1), DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), Convert.ToInt16(DateTime.Now.ToString("MM")) + 1)).ToString("MM/dd/yyyy"); } else { int nxtYr = Convert.ToInt16(DateTime.Now.ToString("yyyy")) + 1; date = new DateTime(nxtYr, 1, DateTime.DaysInMonth(Convert.ToInt16(DateTime.Now.ToString("yyyy")), 1)).ToString("MM/dd/yyyy"); } } Thread.Sleep(2000); dt.Clear(); GoodThroughDate = date; driver.FindElement(By.Id("interestCalDate_input")).SendKeys(date); driver.FindElement(By.Id("btnRecalInterest")).SendKeys(Keys.Enter); //*[@id=""] } else { GoodThroughDate = ""; } TaxMailingAddress = driver.FindElement(By.Id("lblMailingAddr")).Text; RealValue = driver.FindElement(By.Id("lblRealOriginal")).Text; DeferredValue = driver.FindElement(By.Id("lblDeferredOriginal")).Text; UseValue = driver.FindElement(By.Id("lblUseOriginal")).Text; PersonalValue = driver.FindElement(By.Id("lblPersonalOriginal")).Text; ExemptExclusion = driver.FindElement(By.Id("lblExemptOriginal")).Text; TotalAssessedValue = driver.FindElement(By.Id("lblTotalValue")).Text; BillTaxYear = driver.FindElement(By.Id("lblBill")).Text; BillTaxYear = BillTaxYear.Substring(11, 4); gc.CreatePdf(orderNumber, ParcelID, "Tax" + BillTaxYear, driver, "NC", "Forsyth"); PropertyTax = driver.FindElement(By.Id("lblPropertyType")).Text; BillStatus = driver.FindElement(By.Id("lblBillStatus")).Text; BillNumber = driver.FindElement(By.Id("lblBill")).Text; OldBillNumber = driver.FindElement(By.Id("lblLegacyBillNum")).Text; OldAccountNumber = driver.FindElement(By.Id("lblLegacyAccountNum")).Text; DueDate = driver.FindElement(By.Id("lblDueDate")).Text; InterestBegins = driver.FindElement(By.Id("lblInterest")).Text; InterestAmount = driver.FindElement(By.Id("lblInterestAmt")).Text; TotalBilled = driver.FindElement(By.Id("lblTotalAmountDue")).Text; LastPaymentDate = driver.FindElement(By.Id("lblLastPaymentDate")).Text; CurrentDue = driver.FindElement(By.Id("lblCurrentDue")).Text; string discounttext = driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td[2]/table[4]/tbody/tr/td/table")).Text; if (discounttext.Contains("Discount Period")) { DiscountPeriod = gc.Between(discounttext, "Discount Period:", "Correct if paid by").Replace("\r\n", "").Trim(); } //DiscountPeriod= driver.FindElement(By.XPath("/html/body/table/tbody/tr[2]/td[2]/table[4]/tbody/tr/td/table/tbody/tr[1]/td[2]/font")).Text; TaxAuthority = "Forsyth County Tax Collector P.O.Box 82 Winston - Salem, NC 27102"; string TaxInformationdetails = TaxMailingAddress + "~" + RealValue + "~" + DeferredValue + "~" + UseValue + "~" + PersonalValue + "~" + ExemptExclusion + "~" + TotalAssessedValue + "~" + BillTaxYear + "~" + PropertyTax + "~" + BillStatus + "~" + BillFlag + "~" + BillNumber + "~" + OldBillNumber + "~" + OldAccountNumber + "~" + DueDate + "~" + InterestBegins + "~" + InterestAmount + "~" + TotalBilled + "~" + LastPaymentDate + "~" + CurrentDue + "~" + DiscountPeriod + "~" + GoodThroughDate + "~" + TaxAuthority; gc.insert_date(orderNumber, ParcelID, 610, TaxInformationdetails, 1, DateTime.Now); } catch { } } //Tax/Fee Distribution Details IWebElement tbmulti = driver.FindElement(By.XPath("//*[@id='dgShowResultRate']/tbody")); IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr")); IList <IWebElement> TDmulti; foreach (IWebElement row in TRmulti) { TDmulti = row.FindElements(By.TagName("td")); if (!row.Text.Contains("Rate")) { if (TDmulti.Count == 4) { string TaxDistribution = BillTaxYear + "~" + TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text; gc.insert_date(orderNumber, ParcelID, 611, TaxDistribution, 1, DateTime.Now); } } } } TaxTime = DateTime.Now.ToString("HH:mm:ss"); driver.Quit(); gc.mergpdf(orderNumber, "NC", "Forsyth"); LastEndTime = DateTime.Now.ToString("HH:mm:ss"); gc.insert_TakenTime(orderNumber, "NC", "Forsyth", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime); return("Data Inserted Successfully"); } catch (Exception ex) { driver.Quit(); GlobalClass.LogError(ex, orderNumber); throw ex; } } }
/// <summary> /// Switch to a pop up window by clicking on an HtmlControl. /// </summary> /// <param name="controlToClick">HtmlControl to click to open the pop up window.</param> public static void SwitchToPopupWindow(this IWebDriver driver, HtmlControl controlToClick) { PopupWindowFinder pop = new PopupWindowFinder(driver, TimeSpan.FromSeconds(15)); driver.SwitchToWindow(pop.Click(controlToClick.Element)); }
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 AbtValues() { finder = new PopupWindowFinder(SeleniumDriver.Instance); finder.Click(abtvalueLink); }
/// <summary> /// Finds the popup using the specified By and clicks on it /// </summary> /// <param name="by"></param> /// <returns></returns> protected string ClickWithPopup(By by) { var finder = new PopupWindowFinder(baseDriver); return(finder.Click(GetClickableElement(by))); }
public void DoDailyAction(IWebDriver driver) { driver.Navigate().GoToUrl(@"https://sixthcontinent.com/"); // handle di sixthcontinent string sixthcontinentHandle = driver.CurrentWindowHandle; sb.AppendLine($"Sixthcontinent window handle {sixthcontinentHandle}"); sb.AppendLine("Ricerca link Accedi"); IWebElement l1 = driver.FindElement(By.CssSelector(cssSelAccedi)); if (l1 == null) { sb.AppendLine($"Link non trovato con selector {cssSelAccedi}"); return; } var jsToBeExecuted = $"window.scroll(0, {l1.Location.Y});"; ((IJavaScriptExecutor)driver).ExecuteScript(jsToBeExecuted); var wait = new WebDriverWait(driver, TimeSpan.FromMinutes(1)); var readyElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector(cssSelAccedi))); sb.AppendLine("Click su accedi"); readyElement.Click(); sb.AppendLine("Aspetta elemento Login With Amazon"); wait = new WebDriverWait(driver, TimeSpan.FromMinutes(1)); readyElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.Id(loginWithAmazonId))); PopupWindowFinder finder = new PopupWindowFinder(driver); sb.AppendLine("Click su Login with Amazon"); string amazonWindowHandle = finder.Click(readyElement); //clickableElement.Click(); driver.WindowHandles.ToList().ForEach(wh => Console.WriteLine()); driver.SwitchTo().Window(amazonWindowHandle); sb.AppendLine("Aspetta email text field"); wait.Until(ExpectedConditions.ElementIsVisible(By.Id(emailTagId))); sb.AppendLine("Set username"); var textEl = driver.FindElement(By.Id(emailTagId)); textEl.SendKeys(email); sb.AppendLine("Set password"); textEl = driver.FindElement(By.Id(passwordTagId)); textEl.SendKeys(password); wait = new WebDriverWait(driver, TimeSpan.FromMinutes(1)); readyElement = wait.Until(ExpectedConditions.ElementToBeClickable(By.CssSelector(submitButtonSel))); readyElement.Click(); //readyElement driver.SwitchTo().Window(sixthcontinentHandle); wait = new WebDriverWait(driver, TimeSpan.FromMinutes(1)); readyElement = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(profileTagSel))); }
public string FTP_NCGuilford(string houseno, string sname, string sttype, string unitno, string parcelNumber, string searchType, string orderNumber, string ownername, string directParcel) { GlobalClass.global_orderNo = orderNumber; HttpContext.Current.Session["orderNo"] = orderNumber; GlobalClass.global_parcelNo = parcelNumber; string StartTime = "", AssessmentTime = "", TaxTime = "", CitytaxTime = "", LastEndTime = ""; //IWebElement iframeElement1; var driverService = PhantomJSDriverService.CreateDefaultService(); driverService.HideCommandPromptWindow = true; using (driver = new PhantomJSDriver()) { try { StartTime = DateTime.Now.ToString("HH:mm:ss"); driver.Navigate().GoToUrl("http://taxcama.guilfordcountync.gov/camapwa/SearchProperty.aspx"); if (searchType == "address") { driver.FindElement(By.XPath("//*[@id='panelSummary']/li[2]/a")).Click(); Thread.Sleep(2000); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetNumberTextBox")).SendKeys(houseno); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetNameTextBox")).SendKeys(sname.Trim()); gc.CreatePdf_WOP(orderNumber, "Address Search", driver, "NC", "Guilford"); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_AddressButton")).SendKeys(Keys.Enter); Thread.Sleep(2000); gc.CreatePdf_WOP(orderNumber, "Address Search result", driver, "NC", "Guilford"); //try { // string mul = driver.FindElement(By.Id("ctl00_SearchPageHeader_SearchResultDetailsLabel")).Text; // mul = WebDriverTest.Before(mul, " Records"); // if ((mul != "1") && (mul != "0")) // { // //multi parcel // try // { // tbmulti3 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder2_ParcelStreetsGridView']/tbody")); // } // catch { } // try // { // tbmulti3 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder2_streetDictionaryResultsGridView']/tbody")); // } // catch { } // IList<IWebElement> TRmulti3 = tbmulti3.FindElements(By.TagName("tr")); // int maxCheck = 0; // IList<IWebElement> TDmulti3; // foreach (IWebElement row in TRmulti3) // { // if (maxCheck <= 25) // { // TDmulti3 = row.FindElements(By.TagName("td")); // if (TDmulti3.Count != 0) // {//Parcel Number~Address~Owner Name // string multi1 = TDmulti3[1].Text + " " + TDmulti3[4].Text + " " + TDmulti3[5].Text + "~" + TDmulti3[8].Text; // gc.insert_date(orderNumber, TDmulti3[0].Text, 597, multi1, 1, DateTime.Now); // } // maxCheck++; // } // } // if (TRmulti3.Count > 25) // { // HttpContext.Current.Session["multiParcel_Guilford_Multicount"] = "Maximum"; // } // else // { // HttpContext.Current.Session["multiparcel_Guilford"] = "Yes"; // } // driver.Quit(); // return "MultiParcel"; // } // else // { // driver.FindElement(By.XPath(" //*[@id='ctl00_ContentPlaceHolder2_ParcelStreetsGridView']/tbody/tr[2]/td[1]/a")).Click(); // Thread.Sleep(2000); // try // { // driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder2_streetDictionaryResultsGridView']/tbody")).Click(); // } // catch { } // } //} //catch { } // CreatePdf_WOP(orderNumber, "Multiparcel Address Search"); try { string mul = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text; mul = WebDriverTest.Before(mul, "Records").Trim(); int i, j = 2; if ((mul != "1") && (mul != "0")) { int iRowsCount = driver.FindElements(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView']/tbody/tr")).Count; for (i = 2; i <= iRowsCount; i++) { if (j >= 2 && i != 2) { IWebElement checkbox1 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView_ctl0" + j + "_CheckBox1']")); // checkbox.Clear(); checkbox1.Click(); Thread.Sleep(1000); j++; } IWebElement checkbox = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_streetDictionaryResultsGridView_ctl0" + i + "_CheckBox1']")); // checkbox.Clear(); checkbox.Click(); Thread.Sleep(1000); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_StreetDictionarySearchButton")).SendKeys(Keys.Enter); Thread.Sleep(1000); string mul1 = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text; mul1 = GlobalClass.Before(mul1, " Records Matched Search Criteria").Trim(); int count = Convert.ToInt32(mul1); if (count > 0) { //multi parcel gc.CreatePdf_WOP(orderNumber, "Multiparcel Result", driver, "NC", "Guilford"); IWebElement tbmulti2 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody")); IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr")); IList <IWebElement> TDmulti2; int rescount = TRmulti2.Count; foreach (IWebElement row in TRmulti2) { TDmulti2 = row.FindElements(By.TagName("td")); if (TDmulti2.Count != 0 && TDmulti2[1].Text.Trim() != "" && !row.Text.Contains("Pfx") && TDmulti2.Count == 9) { IWebElement multiparcellink = TDmulti2[0].FindElement(By.TagName("a")); string strmulti = multiparcellink.GetAttribute("href"); multiparcel.Add(strmulti); string multi1 = TDmulti2[1].Text + " " + TDmulti2[4].Text + "~" + TDmulti2[8].Text; if (TDmulti2[1].Text == houseno || houseno == "0") { gc.insert_date(orderNumber, TDmulti2[0].Text, 597, multi1, 1, DateTime.Now); } // Owner~address } } } driver.Navigate().Back(); Thread.Sleep(1000); } if (multiparcel.Count > 1) { HttpContext.Current.Session["multiparcel_Guilford"] = "Yes"; driver.Quit(); return("MultiParcel"); } else { foreach (string real in multiparcel) { driver.Navigate().GoToUrl(real); Thread.Sleep(4000); } } } else { driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_ParcelStreetsGridView']/tbody/tr[2]/td[1]/a")).SendKeys(Keys.Enter); Thread.Sleep(2000); } } catch { } } if (searchType == "titleflex") { string titleaddress = houseno + " " + sname + " " + sttype + " " + unitno; gc.TitleFlexSearch(orderNumber, "", "", titleaddress, "NC", "Guilford"); 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_NCGuilford"] = "Yes"; driver.Quit(); return("No Data Found"); } parcelNumber = HttpContext.Current.Session["titleparcel"].ToString(); searchType = "parcel"; } if (searchType == "parcel") { Thread.Sleep(3000); if ((HttpContext.Current.Session["TitleFlex_Search"] != null && HttpContext.Current.Session["TitleFlex_Search"].ToString() == "Yes")) { parcelNumber = HttpContext.Current.Session["titleparcel"].ToString(); } driver.FindElement(By.XPath("//*[@id='panelSummary']/li[3]/a")).Click(); Thread.Sleep(2000); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_REIDTextBox")).SendKeys(parcelNumber); gc.CreatePdf(orderNumber, parcelNumber, "Parcel Search", driver, "NC", "Guilford"); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_ReidButton")).SendKeys(Keys.Enter); Thread.Sleep(2000); } if (searchType == "block") { driver.FindElement(By.Id("__tab_ctl00_ContentPlaceHolder1_Tabs_PinTabPanel")).Click(); Thread.Sleep(2000); string unitNum = unitno.Replace(" ", ""); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Tabs_PinTabPanel_PINNumberTextBox")).SendKeys(sttype); gc.CreatePdf_WOP(orderNumber, "block Search", driver, "NC", "Guilford"); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_Tabs_PinTabPanel_PinButton")).SendKeys(Keys.Enter); Thread.Sleep(2000); } if (searchType == "ownername") { driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_OwnerTextBox")).SendKeys(ownername); gc.CreatePdf_WOP(orderNumber, "Owner Search", driver, "NC", "Guilford"); driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_OwnerButton")).SendKeys(Keys.Enter); Thread.Sleep(2000); try { string mul = driver.FindElement(By.Id("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table/tbody/tr[1]/td[2]/span")).Text; mul = WebDriverTest.Before(mul, " Records"); if ((mul != "1") && (mul != "0")) { //multi parcel //*[@id="ctl00_ContentPlaceHolder2_OwnerSearchResultsGridView"]/tbody IWebElement tbmulti4 = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder2_OwnerSearchResultsGridView']/tbody")); IList <IWebElement> TRmulti4 = tbmulti4.FindElements(By.TagName("tr")); int maxCheck = 0; IList <IWebElement> TDmulti4; foreach (IWebElement row in TRmulti4) { if (maxCheck <= 25) { TDmulti4 = row.FindElements(By.TagName("td")); if (TDmulti4.Count != 0) { string multi1 = TDmulti4[1].Text + "~" + TDmulti4[2].Text; gc.insert_date(orderNumber, TDmulti4[0].Text, 597, multi1, 1, DateTime.Now); } maxCheck++; } } if (TRmulti4.Count > 25) { HttpContext.Current.Session["multiParcel_Guilford_Multicount"] = "Maximum"; } else { HttpContext.Current.Session["multiparcel_Guilford"] = "Yes"; } driver.Quit(); return("MultiParcel"); } else { driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_OwnerSearchResultsGridView']/tbody/tr[2]/td[3]/a")).Click(); } } catch { } } try { IWebElement INodata = driver.FindElement(By.XPath("//*[@id='aspnetForm']/div[3]/table/tbody/tr[2]/td[2]/div/div/div/div/table")); if (INodata.Text.Contains("0 Records Matched Search Criteria")) { HttpContext.Current.Session["Nodata_NCGuilford"] = "Yes"; driver.Quit(); return("No Data Found"); } } catch { } //property_details //PIN #~Location Address~Property Description~Property Owner~City~Land Class~Acreage~Year Built string parcel_no = "", pin = "", location_address = "", PropertyDescription = "", PropertyOwner = ""; string city = "", Land_class = "", Acreage = "", year_built = ""; string reid = driver.FindElement(By.Id("ctl00_PageHeader1_ReidLabelInfo")).Text.Trim(); parcel_no = driver.FindElement(By.Id("ctl00_PageHeader1_ReidLabelInfo")).Text.Trim(); gc.CreatePdf(orderNumber, parcel_no, "property details", driver, "NC", "Guilford"); pin = driver.FindElement(By.Id("ctl00_PageHeader1_PinLabelInfo")).Text.Trim(); location_address = driver.FindElement(By.Id("ctl00_PageHeader1_LocationAddressLabelInfo")).Text.Trim(); PropertyDescription = driver.FindElement(By.Id("ctl00_PageHeader1_PropertyDescriptionLabelInfo")).Text.Trim(); PropertyOwner = driver.FindElement(By.Id("ctl00_PageHeader1_DetailsView1")).Text.Trim(); string bulkpropertytext = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_DetailsView5']/tbody")).Text; city = gc.Between(bulkpropertytext, "City", "Fire District").Trim(); Land_class = gc.Between(bulkpropertytext, "Land Class", "History REID 1").Trim(); Acreage = gc.Between(bulkpropertytext, "Acreage", "Permit Date").Trim(); driver.FindElement(By.Id("ctl00_PageHeader1_BuildingsHyperLink")).Click(); gc.CreatePdf(orderNumber, parcel_no, "Building details", driver, "NC", "Guilford"); try { year_built = driver.FindElement(By.Id("ctl00_ContentPlaceHolder1_DetailsView4_Label1")).Text.Trim(); //year_built = gc.Between(year_built, "", "").Trim(); } catch { } string Land_Value = "", Building_Value = "", Outbuilding_Value = "", Appraised_Value = "", OtherExemptions = "", UseValueDeferred = "", Historic_Value_Deferred = "", Total_Deferred_Value = "", Total_Assessed_Value = ""; string bulkassessmenttext = driver.FindElement(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_table8']/tbody")).Text;; string currentHandle = driver.CurrentWindowHandle; IWebElement element = driver.FindElement(By.LinkText("Print Property Info")); PopupWindowFinder finder = new PopupWindowFinder(driver); string popupWindowHandle = finder.Click(element); driver.SwitchTo().Window(popupWindowHandle); gc.CreatePdf(orderNumber, parcel_no, "Assessment Details", driver, "NC", "Guilford"); Thread.Sleep(3000); IWebElement asstableElement = driver.FindElement(By.XPath("//*[@id='headerPlaceholder']/div/div[4]/div/table/tbody")); IList <IWebElement> asstableElementRow = asstableElement.FindElements(By.TagName("tr")); IList <IWebElement> asstableElementRowTD; IList <IWebElement> asstableElementRowTH; var assesscolumn = ""; var assessvalue = ""; foreach (IWebElement rowid in asstableElementRow) { asstableElementRowTD = rowid.FindElements(By.TagName("td")); asstableElementRowTH = rowid.FindElements(By.TagName("th")); if (asstableElementRowTD.Count != 0 && !rowid.Text.Contains("Property Value") && rowid.Text != "") { if (asstableElementRowTD[0].Text != " ") { assesscolumn += asstableElementRowTH[0].Text + "~"; assessvalue += asstableElementRowTD[0].Text + "~"; } } } assesscolumn = assesscolumn.TrimEnd('~'); assessvalue = assessvalue.TrimEnd('~'); DBconnection dbconn = new DBconnection(); dbconn.ExecuteQuery("update data_field_master set Data_Fields_Text='" + assesscolumn + "' where Id = '" + 599 + "'"); gc.insert_date(orderNumber, parcel_no, 599, assessvalue, 1, DateTime.Now); // Total Appraised Land Value~Total Appraised Building Value~Total Appraised Outbuilding Value~Total Appraised Value~Other Exemptions~Use Value Deferred~Historic Value Deferred~Total Deferred Value~Total Assessed Value //Land_Value = gc.Between(bulkassessmenttext, "TotalAppraisedLandValue", "TotalAppraisedBuildingValue").Trim(); //Building_Value = gc.Between(bulkassessmenttext, "TotalAppraisedBuildingValue", "TotalAppraisedOutbuildingValue").Trim(); //Outbuilding_Value = gc.Between(bulkassessmenttext, "TotalAppraisedOutbuildingValue", "TotalAppraisedValue").Trim(); //Appraised_Value = gc.Between(bulkassessmenttext, "TotalAppraisedValue", "OtherExemptions").Trim(); //OtherExemptions = gc.Between(bulkassessmenttext, "OtherExemptions", "UseValueDeferred").Trim(); //UseValueDeferred = gc.Between(bulkassessmenttext, "UseValueDeferred", "HistoricValueDeferred").Trim(); //Historic_Value_Deferred = gc.Between(bulkassessmenttext, "HistoricValueDeferred", "TotalDeferredValue").Trim(); //Total_Deferred_Value = gc.Between(bulkassessmenttext, "TotalDeferredValue", "TotalAssessedValue").Trim(); //Total_Assessed_Value = GlobalClass.After(bulkassessmenttext, "TotalAssessedValue").Trim(); string property_details = pin + "~" + location_address + "~" + PropertyDescription + "~" + PropertyOwner + "~" + city + "~" + Land_class + "~" + Acreage + "~" + year_built; gc.insert_date(orderNumber, parcel_no, 598, property_details, 1, DateTime.Now); //string assessment_details = Land_Value + "~" + Building_Value + "~" + Outbuilding_Value + "~" + Appraised_Value + "~" + OtherExemptions + "~" + UseValueDeferred + "~" + Historic_Value_Deferred + "~" + Total_Deferred_Value + "~" + Total_Assessed_Value; //gc.insert_date(orderNumber, parcel_no, 599, assessment_details, 1, DateTime.Now); AssessmentTime = DateTime.Now.ToString("HH:mm:ss"); //Tax Details driver.Navigate().GoToUrl("http://taxweb.guilfordcountync.gov/publicwebaccess/BillSearchResults.aspx?ParcelNum=" + reid); //IWebElement Itaxstmt = driver.FindElement(By.XPath("//*[@id='ctl00_PageHeader1_TaxBillHyperLink']")); //string stmt1 = Itaxstmt.GetAttribute("href"); //driver.Navigate().GoToUrl(stmt1); //Thread.Sleep(2000); gc.CreatePdf(orderNumber, parcel_no, "Tax bill table", driver, "NC", "Guilford"); //Transaction payment Details Table: //Bill#~Old Bill #~Parcel #~Name~Location~Bill Flags~Current Due~Total: IWebElement tbmulti = driver.FindElement(By.XPath("//*[@id='G_dgResults']/tbody")); IList <IWebElement> TRmulti = tbmulti.FindElements(By.TagName("tr")); IList <IWebElement> TDmulti; IList <IWebElement> THmulti; int b = 0; foreach (IWebElement row in TRmulti) { TDmulti = row.FindElements(By.TagName("td")); THmulti = row.FindElements(By.TagName("th")); if (b < 3 && TDmulti.Count != 0) { IWebElement ITaxBillCount = TDmulti[0].FindElement(By.TagName("a")); string strTaxReal = ITaxBillCount.GetAttribute("href"); strTaxRealestate.Add(strTaxReal); b++; } if (TDmulti.Count == 7) { string transpay1 = TDmulti[0].Text + "~" + TDmulti[1].Text + "~" + TDmulti[2].Text + "~" + TDmulti[3].Text + "~" + TDmulti[4].Text + "~" + TDmulti[5].Text + "~" + TDmulti[6].Text; gc.insert_date(orderNumber, parcel_no, 601, transpay1, 1, DateTime.Now); } if (THmulti.Count != 0) { string transhistory11 = "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "Total" + "~" + THmulti[7].Text; gc.insert_date(orderNumber, parcel_no, 601, transhistory11, 1, DateTime.Now); } } int k = 1; foreach (string real in strTaxRealestate) { driver.Navigate().GoToUrl(real); Thread.Sleep(4000); if (k == 1) { //Thread.Sleep(2000); gc.CreatePdf(orderNumber, parcel_no, "Tax bill1", driver, "NC", "Guilford"); string owner_name = "", Description = "", Location = "", Parcel = "", Lender = "", RealValue = "", DeferredValue = "", UseValue = "", PersonalValue = "", ExemptValue = "", TotalAssessedValue = ""; //Owner Name~Description~Location~Lender~Real Value~Deferred Value~Use Value~Personal Value~Exempt & Exclusion Value~Total Assessed Value~Bill Status~Bill Flag~Bill Number~Old Bill Number~Old Account Number~Due Date~Interest Begins~Rate~Tax Districts~Descriptions~Amount~Interest Amount~Total Amount Due~Tax Authority owner_name = driver.FindElement(By.Id("txtName")).Text.Trim(); Description = driver.FindElement(By.Id("lblDescr")).Text.Trim(); Location = driver.FindElement(By.Id("lblPropAddr")).Text.Trim(); Parcel = driver.FindElement(By.Id("lblParcel")).Text.Trim(); Lender = driver.FindElement(By.Id("lblLender")).Text.Trim(); RealValue = driver.FindElement(By.Id("lblRealOriginal")).Text.Trim(); DeferredValue = driver.FindElement(By.Id("lblDeferredOriginal")).Text.Trim(); UseValue = driver.FindElement(By.Id("lblUseOriginal")).Text.Trim(); PersonalValue = driver.FindElement(By.Id("lblPersonalOriginal")).Text.Trim(); ExemptValue = driver.FindElement(By.Id("lblExemptOriginal")).Text.Trim(); TotalAssessedValue = driver.FindElement(By.Id("lblTotalValue")).Text.Trim(); string BillStatus = "", BillFlag = "", Bill = "", OldBill = "", OldAccountNum = "", DueDate = "", InterestBegins = "", TotalAmountDue = "", InterestAmt = ""; BillStatus = driver.FindElement(By.Id("lblBillStatus")).Text.Trim(); BillFlag = driver.FindElement(By.Id("lblBillFlag")).Text.Trim(); Bill = driver.FindElement(By.Id("lblBill")).Text.Trim(); OldBill = driver.FindElement(By.Id("lblLegacyBillNum")).Text.Trim(); OldAccountNum = driver.FindElement(By.Id("lblLegacyAccountNum")).Text.Trim(); DueDate = driver.FindElement(By.Id("lblDueDate")).Text.Trim(); InterestBegins = driver.FindElement(By.Id("lblInterest")).Text.Trim(); Thread.Sleep(5000); InterestAmt = driver.FindElement(By.Id("lblInterestAmt")).Text.Trim(); TotalAmountDue = driver.FindElement(By.Id("lblTotalAmountDue")).Text.Trim(); string TaxBill_details = owner_name + "~" + Description + "~" + Location + "~" + Lender + "~" + RealValue + "~" + DeferredValue + "~" + UseValue + "~" + PersonalValue + "~" + ExemptValue + "~" + TotalAssessedValue + "~" + BillStatus + "~" + BillFlag + "~" + Bill + "~" + OldBill + "~" + OldAccountNum + "~" + DueDate + "~" + InterestBegins + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + InterestAmt + "~" + TotalAmountDue + "~" + " 400 West Market St, Greensboro, North Carolina 27401 Phone: (336) 641 - 3363"; gc.insert_date(orderNumber, parcel_no, 600, TaxBill_details, 1, DateTime.Now); IWebElement tbmulti2 = driver.FindElement(By.XPath("//*[@id='dgShowResultRate']/tbody")); IList <IWebElement> TRmulti2 = tbmulti2.FindElements(By.TagName("tr")); IList <IWebElement> TDmulti2; foreach (IWebElement row in TRmulti2) { TDmulti2 = row.FindElements(By.TagName("td")); if (!row.Text.Contains("Rate")) { if (TDmulti2.Count == 4) { string transbill = "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + TDmulti2[0].Text + "~" + TDmulti2[1].Text + "~" + TDmulti2[2].Text + "~" + TDmulti2[3].Text + "" + "~" + "" + "~" + ""; gc.insert_date(orderNumber, parcel_no, 600, transbill, 1, DateTime.Now); } } } //Transaction History Details Table: //Date~Type~Paid By~Trans #~Amount~Current Due string CurrentDue = driver.FindElement(By.Id("lblCurrentDue")).Text.Trim(); IWebElement tbmulti1 = driver.FindElement(By.XPath("//*[@id='dgShowResultHistory']/tbody")); IList <IWebElement> TRmulti1 = tbmulti1.FindElements(By.TagName("tr")); IList <IWebElement> TDmulti1; foreach (IWebElement row in TRmulti1) { TDmulti1 = row.FindElements(By.TagName("td")); if (TDmulti1.Count == 6) { string transhistory = TDmulti1[0].Text + "~" + TDmulti1[1].Text + "~" + TDmulti1[2].Text + "~" + TDmulti1[3].Text + "~" + TDmulti1[4].Text + "~" + ""; gc.insert_date(orderNumber, parcel_no, 602, transhistory, 1, DateTime.Now); } } string transhistory1 = "" + "~" + "" + "~" + "" + "~" + "" + "~" + "" + "~" + CurrentDue; gc.insert_date(orderNumber, parcel_no, 602, transhistory1, 1, DateTime.Now); } if (k == 2) { gc.CreatePdf(orderNumber, parcel_no, "Tax bill2", driver, "NC", "Guilford"); } if (k == 3) { gc.CreatePdf(orderNumber, parcel_no, "Tax bill3", driver, "NC", "Guilford"); } k++; } TaxTime = DateTime.Now.ToString("HH:mm:ss"); LastEndTime = DateTime.Now.ToString("HH:mm:ss"); gc.insert_TakenTime(orderNumber, "NC", "Guilford", StartTime, AssessmentTime, TaxTime, CitytaxTime, LastEndTime); driver.Quit(); GlobalClass.titleparcel = ""; gc.mergpdf(orderNumber, "NC", "Guilford"); return("Data Inserted Successfully"); } catch (Exception ex) { driver.Quit(); throw ex; } } }