public CalendarSelectDatesControl Activate() { if (!SelectDatesPanel.WrappedElement.Displayed) { CheckInElement.Click(); AutomationWait <CalendarSelectDatesControl> .On(SelectDatesPanel) .UpTo(TimeSpan.FromMilliseconds(500)) .TimeoutMessage("Select dates panel not displayed when control clicked") .Until(x => x.Displayed); } return(SelectDatesPanel); }
public void AcceptCookies() { //Would create a class for cookies banner if creating a full framework var panelElement = By.Id("onetrust-banner-sdk"); var acceptButtonLocator = By.Id("onetrust-accept-btn-handler"); //Wait for Cookies banner to be in position before clicking AutomationWait <IWebDriver> .On(_driver) .SilentUntil(x => x.FindElements(panelElement) != null && x.FindElement(panelElement).GetAttribute("style").Contains("0px")); _driver.FindElement(acceptButtonLocator).Click(); }
//A bit rough and ready but serves as a quick check if ElementExists on page //With more time would implement as an Extension method on driver //Would make timeout configurable if building full framework public virtual bool WaitForElementToExist(By elementLocator, int timeOut = 30) { return(AutomationWait <IWebDriver> .On(_driver) .UpTo(TimeSpan.FromSeconds(timeOut)) .Until(x => x.FindElement(elementLocator)).Displayed); }
protected bool WaitForElementToBeDisplayed(By elementLocator, int timeOut = 3) { return(AutomationWait <IWebDriver> .On(WrappedDriver) .Until(x => x.FindElements(elementLocator) != null && x.FindElement(elementLocator).Displayed)); }