public void GivenIEnterTimeOfAndDateOfInTheSection(string p0, string p1, string p2) {//Choose Entry Date and Time ParkingCalcDriver.setTime(p0, p2); string[] sdt = p1.Split(new char[] { '/' }, StringSplitOptions.None); int[] dt = Array.ConvertAll(sdt, int.Parse); ParkingCalcDriver.SetCalendar(dt[2], dt[0], dt[1], p2); }
public void GivenThatINavigateWithBrowserTo(string p0) { //ScenarioContext.Current.Pending(); //SeleniumFW se=new SeleniumFW("chrome",p0,true); //Console.WriteLine(se.BrowserDriver.Title); //ScenarioContext.Current.Pending(); ParkingCalcDriver.InitBrowser(); }
public void ThenTheDurationOfStayIsEqualTo(string p0) { // $ 2.00 (0 Days, 1 Hours, 0 Minutes) results = ParkingCalcDriver.DoCalcs(_cost, p0); Console.WriteLine(string.Join("|", results)); }
public void GivenISelectTheAmpmOfOptionInTheSection(string p0, string p1) { ParkingCalcDriver.setAMPM(p0, p1); }
public void GivenISelectTheOptionInTheDropdown(string p0, string p1) { ParkingCalcDriver.chooseLot(p0); }
public static IWebElement SetCalendar(int year, int mn, int day, string entryleave) { IWebElement rc = null; //Choose Entry Date and Time //Choose Leaving Date and Time string startend = "EntryTime"; if (entryleave.Contains("Choose Leaving")) { startend = "ExitDate"; } else if (entryleave.Contains("Choose Entry")) { startend = "EntryDate"; } string[] months = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; if (mn < 1) { Console.WriteLine("Invalid month index of less than 1"); return(null); } string month = months[mn - 1]; IWebElement cal = FindElementsAtrib(By.TagName("a"), "href", startend); if (cal == null) { Console.WriteLine("Error: Calendar not found"); return(null); } //invoke cal cal.Click(); Thread.Sleep(1000); //set to window if (!setToPopupWin("Pick a Date")) { Console.WriteLine("Error: Calendar popup not found"); return(null); } //set year //body > form > table > tbody > tr:nth-child(1) > td > table > tbody > tr > td:nth-child(2) cal = Browser.FindElement(By.CssSelector("body > form > table > tbody > tr:nth-child(1) > td > table > tbody > tr > td:nth-child(2)")); //< a href = "javascript:winMain.Cal.DecYear();winMain.RenderCal()" >< b >< font color = "#00306C" > <</ font ></ b ></ a > //body > form > table > tbody > tr:nth-child(1) > td > table > tbody > tr > td:nth-child(2) > a:nth-child(1) IWebElement decyr = FindElementsAtrib(By.TagName("a"), "href", "Cal.DecYear()", cal); if (decyr.Text != "<") { Console.WriteLine("Year decreament not found"); return(null); } //body > form > table > tbody > tr:nth-child(1) > td > table > tbody > tr > td:nth-child(2) > a:nth-child(3) IWebElement incyr = FindElementsAtrib(By.TagName("a"), "href", "Cal.IncYear()", cal); if (incyr.Text != ">") { Console.WriteLine("Year increament not found"); return(null); } //body > form > table > tbody > tr:nth-child(1) > td > table > tbody > tr > td:nth-child(2) > a:nth-child(2) IWebElement yr = cal.FindElements(By.TagName("b"))[1]; int nyr = 0; Int32.TryParse(yr.Text, out nyr); while (nyr != year) { if (nyr < year) { incyr = FindElementsAtrib(By.TagName("a"), "href", "Cal.IncYear()", cal); incyr.Click(); Thread.Sleep(200); } else if (nyr > year) { decyr = FindElementsAtrib(By.TagName("a"), "href", "Cal.DecYear()", cal); decyr.Click(); Thread.Sleep(200); } else { break; } cal = Browser.FindElement(By.CssSelector("body > form > table > tbody > tr:nth-child(1) > td > table > tbody > tr > td:nth-child(2)")); yr = yr = cal.FindElements(By.TagName("b"))[1]; Int32.TryParse(yr.Text, out nyr); } //set month //body > form > table > tbody > tr:nth-child(1) > td > table > tbody > tr > td:nth-child(1) > select cal = Browser.FindElement(By.CssSelector("body > form > table > tbody > tr:nth-child(1) > td > table > tbody > tr > td:nth-child(1) > select")); cal.Click(); Thread.Sleep(200); decyr = FindElementsAtrib(By.TagName("option"), "", month); if (decyr != null) { decyr.Click(); Thread.Sleep(200); } else { Console.WriteLine("Found month"); } //set day //<a href="javascript:winMain.document.getElementById('EntryDate').value='9/3/2017';;window.close();">3</a> string dt = mn.ToString() + "/" + day.ToString() + "/" + year.ToString(); string find = @"('" + startend + "').value='" + dt + "'"; decyr = FindElementsAtrib(By.TagName("a"), "href", find); if (decyr != null) { decyr.Click(); Thread.Sleep(200); } if (ParkingCalcDriver.setToManHwnd("Parking Calculator")) { //<input name="EntryDate" type="text" id="EntryDate" value="MM/DD/YYYY" size="15"> decyr = FindElementsAtrib(By.TagName("input"), "name", startend); var ss = decyr.GetAttribute("value"); if (ss == dt) { rc = decyr; } } //cal closes //switch to main hwnd //set date field //return the target date field return(rc); }