internal static void WaitForLoad() { Driver.WaitForAjax(); Guids.SearchGuid = PageFunctions.GetSearchGUID(); Guids.pageUrl = PageFunctions.GetUrl(); Driver.FindElementWithTimeout(By.Id("accommodationresultspage"), 40, "Accommodation result page not displayed in 40 secs"); }
public void Continue() { foreach (Room room in this.rooms) { if (this.rooms.IndexOf(room) > 0) { EstablishmentPage.SelectRoomTab(room.roomNumber); if (room.availableRoomNumber != 0) { EstablishmentPage.SelectRoomByNumber(room.availableRoomNumber); } Driver.WaitForAjax(); Driver.Wait(TimeSpan.FromSeconds(1)); EstablishmentPage.ClickContinueButton(); try { PageFunctions.WaitForLoad("agentpaymentpage", "Payment page not displayed in 40 secs"); } catch (Exception ex) { Guids.SearchGuid = PageFunctions.GetSearchGUID(); Guids.pageUrl = PageFunctions.GetUrl(); ReadOnlyCollection <IWebElement> ErrMsgsDivs = Driver.Instance.FindElements(By.CssSelector("div.box-header h4.box-heading")); IWebElement displayedErrMsg; try { displayedErrMsg = ErrMsgsDivs.First(i => i.Displayed); } catch { throw ex; } if (displayedErrMsg.Text.Trim() == "Hotel unavailable") { throw new Exception(string.Format("Selected Hotel room(s) are fully booked for the dates selected.")); } if (displayedErrMsg.Text.Trim() == "No results found") { throw new Exception(string.Format("For Selected Hotel 'No results found' error message is displayed.")); } if (displayedErrMsg.Text.Trim() == "Room unavailable") { throw new Exception(string.Format("For Room Number {0} selected room {1} is no longer available.", room.roomNumber, room.availableRoomNumber)); } throw ex; } } else { if (room.availableRoomNumber != 0) { EstablishmentPage.SelectRoomByNumber(room.availableRoomNumber); } } } }