public Locate() { var service = PhantomJSDriverService.CreateDefaultService(Environment.CurrentDirectory); service.WebSecurity = false; service.HideCommandPromptWindow = true; driver = new PhantomJSDriver(service); driver.Manage().Window.Size = new System.Drawing.Size(1240, 1240); //var chromeOptions = new ChromeOptions(); //chromeOptions.AddArguments("headless"); //var chromeDriverService = ChromeDriverService.CreateDefaultService(); //// chromeDriverService.HideCommandPromptWindow = true; //driver = new ChromeDriver(chromeDriverService,chromeOptions); //driver.Navigate().GoToUrl("https://facebook.com"); //Thread.Sleep(3000); //Console.WriteLine(driver.WindowHandles.Count); //driver.ExecuteScript("window.open('https://google.com','_blank');"); //Thread.Sleep(3000); //Console.WriteLine(driver.WindowHandles.Count); Console.WriteLine(driver.Capabilities.ToString()); SignInUrl = "https://www.clarkcountycourts.us/Portal/Account/Login"; SignInUrl1 = "https://odysseyadfs.tylertech.com/IdentityServer/account/signin?ReturnUrl=%2fIdentityServer%2fissue%2fwsfed%3fwa%3dwsignin1.0%26wtrealm%3dhttps%253a%252f%252fOdysseyADFS.tylertech.com%252fadfs%252fservices%252ftrust%26wctx%3d4d2b3478-8513-48ad-8998-2652d72a38e9%26wauth%3durn%253a46%26wct%3d2018-04-29T15%253a42%253a35Z%26whr%3dhttps%253a%252f%252fodysseyadfs.tylertech.com%252fidentityserver&wa=wsignin1.0&wtrealm=https%3a%2f%2fOdysseyADFS.tylertech.com%2fadfs%2fservices%2ftrust&wctx=4d2b3478-8513-48ad-8998-2652d72a38e9&wauth=urn%3a46&wct=2018-04-29T15%3a42%3a35Z&whr=https%3a%2f%2fodysseyadfs.tylertech.com%2fidentityserver"; HomePageUrl = "https://www.clarkcountycourts.us/Portal/"; case_ref_num = new CrossRefNumber(); }
private void logCaseNotFound(CrossRefNumber crossRef) { Console.WriteLine("No Cases are Found Against Cross Ref Number " + crossRef.refNum, ToString()); }
private bool findCases(string path, CrossRefNumber crossRef) { try { takescreenshot("before finding cases"); var resFoundSel = "#SmartSearchResults"; var resFound = FindElementIfExists(By.CssSelector(resFoundSel)); if (resFound == null) { logCaseNotFound(crossRef); return(true); } string tbodysel = "#CasesGrid > table:nth-child(1) > tbody:nth-child(3)"; var tbody = driver.FindElementByCssSelector(tbodysel); var trs = tbody.FindElements(By.TagName("tr")); Console.WriteLine(trs.Count); string allcasesUrl = driver.Url; foreach (var tr1 in trs) { CourtCase case1 = new CourtCase(); var caseLink = tr1.FindElement(By.CssSelector(".caseLink")); case1.URL = caseLink.GetAttribute("data-url"); case1.caseNum = crossRef.refNum; case_ref_num.cases.Add(case1); new Actions(driver).Click(caseLink).Perform(); Thread.Sleep(1000); string case_info_div_sel = "#divCaseInformation_body"; try { var body = new WebDriverWait(driver, TimeSpan.FromSeconds(submit_wait)).Until(ExpectedConditions.ElementExists(By.CssSelector(case_info_div_sel))); } catch (Exception ex) { Thread.Sleep(1000); try { var body = new WebDriverWait(driver, TimeSpan.FromSeconds(submit_wait)).Until(ExpectedConditions.ElementExists(By.CssSelector(case_info_div_sel))); } catch (Exception ex1) { Console.WriteLine(driver.Url); Console.WriteLine(ex1.Message); return(false); } } Console.WriteLine("case found" + caseLink.Text); Thread.Sleep(1000); bool flg = process_case(path, case1); if (!flg) { return(flg); } } return(true); } catch (Exception ex) { takescreenshot("exception findcases"); Console.WriteLine(driver.Url); return(false); } }