public void SelectHourAndMinute(string hour, string minute) { string desiredHour = hour; string desiredMinute = AdjustMinuteToBeDivisibleBy5(minute).ToString(); int hourCounter = 0; int minuteCounter = 0; string currentHour = Driver.FindElements(By.XPath("//li[contains(@class, '--is-selected')]"))[0].Text; string currentMinute = Driver.FindElements(By.XPath("//li[(contains(@class, '--is-selected'))]"))[1].Text; if (desiredHour.Length == 1) { desiredHour = $"0{desiredHour}"; } if (desiredMinute.Length == 1) { desiredMinute = $"0{desiredMinute}"; } while (desiredHour != currentHour && hourCounter < 24) { UA.ClickOnElement(UPWARD_HOUR_SCROLLER, "Upward hour scroller."); currentHour = Driver.FindElements(By.XPath("//li[contains(@class, '--is-selected')]"))[0].Text; hourCounter++; } while (desiredMinute != currentMinute && minuteCounter < 20) { UA.ClickOnElement(UPWARD_MINUTE_SCROLLER, "Upward minute scroller."); currentMinute = Driver.FindElements(By.XPath("//li[contains(@class, '--is-selected')]"))[1].Text; minuteCounter++; } }
internal void EnterParkingDetails() { UA.EnterTextInField(PARKING_AT_INPUT_FIELD, "London", "Parking At input field."); Wait.WaitUntilElementIsPresent(AUTO_SUGGESTIVE_DROPDOWN, "Auto suggestive dropdown"); new Actions(Driver).SendKeys(Keys.Enter).Perform(); UA.ClickOnElement(ARRIVING_ON_CALENDAR_FIELD, "Arriving on calendar dropdown field."); UA.ClickOnElement(DONE_BUTTONS, "Arriving on calendar dropdown field."); }
public void FilterDate() { DateTime dateInTwentyEightDays = DateTime.Now.AddDays(28); string getMonthOfDate = dateInTwentyEightDays.ToString("MMM").ToUpper(); string currentMonth = Driver.FindElement(ACTIVE_MONTH_AND_YEAR).Text.Substring(0, 3).ToUpper(); int counter = 0; while (currentMonth != getMonthOfDate && counter < 12) { UA.ClickOnElement(NEXT_MONTH_ICON, "Next month icon"); Wait.WaitUntilElementIsPresent(ACTIVE_MONTH_AND_YEAR, "Active month and year element"); currentMonth = Driver.FindElement(ACTIVE_MONTH_AND_YEAR).Text.Substring(0, 3).ToUpper(); counter++; } ClickDateElementFromCalendar(dateInTwentyEightDays.Day.ToString()); SelectHourAndMinute(dateInTwentyEightDays.Hour.ToString(), dateInTwentyEightDays.Minute.ToString()); }
internal void ClickSearchButton() { UA.ClickOnElement(SEARCH_BUTTON, "Search button"); }
internal void EnterDateLesserThanTwentyEight() { UA.ClickOnElement(LEAVING_ON_INPUT_FIELD, "Arriving On input field."); FilterDate(); UA.ClickOnElement(DONE_BUTTON_FOR_LEAVING_ON, "Done button"); }
internal SearchResultsPage ClickShowParkingSpacesButton() { UA.ClickOnElement(SHOW_PARKING_SPACES_BUTTON, "Show Parking spaces button."); return(new SearchResultsPage(Driver)); }