public static void WaitUntilHidden(Func <IWebElement> mapProp, int timeout = 10) { var driver = WebDriverContext.GetInstance().Driver; var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout)); wait.Until((webDriver) => !(mapProp()?.Displayed).GetValueOrDefault()); }
public static IWebElement WaitForMap(Func <IWebElement> mapProp, int timeout = 10) { var driver = WebDriverContext.GetInstance().Driver; driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); return(mapProp()); }
public void AfterFeature() { if (WebDriverContext.HasInstance) { var instance = WebDriverContext.GetInstance(); instance.Dispose(); } }
public static IWebElement WaitFor <TPage>(Expression <Func <TPage, IWebElement> > expression, int timeout = 10) { var driver = WebDriverContext.GetInstance().Driver; var compiledExp = expression.Compile(); var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout)); return(wait.Until((webDriver) => { var p = PageFactory.InitElements <TPage>(webDriver); return compiledExp.Invoke(p); })); }
public PageBase() { Driver = WebDriverContext.GetInstance().Driver; PageFactory.InitElements(Driver, this); Driver.Manage().Window.Maximize(); }
public void Dispose() { ReleaseUnmanagedResources(); GC.SuppressFinalize(this); _singleton = null; }
public static WebDriverContext GetInstance() { return(_singleton ?? (_singleton = new WebDriverContext())); }