Ejemplo n.º 1
0
        public static IWebElement WaitForMap(Func <IWebElement> mapProp, int timeout = 30)
        {
            var driver = WebDriverContext.GetInstance().Driver;

            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
            return(mapProp());
        }
Ejemplo n.º 2
0
        public static void WaitUntilHidden(Func <IWebElement> mapProp, int timeout = 30)
        {
            var driver = WebDriverContext.GetInstance().Driver;
            var wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(timeout));

            wait.Until((webDriver) => !(mapProp()?.Displayed).GetValueOrDefault());
        }
Ejemplo n.º 3
0
 public void AfterFeature()
 {
     if (WebDriverContext.HasInstance)
     {
         var instance = WebDriverContext.GetInstance();
         instance.Dispose();
     }
 }
Ejemplo n.º 4
0
        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);
            }));
        }
Ejemplo n.º 5
0
 public PageBase()
 {
     Driver = WebDriverContext.GetInstance().Driver;
     PageFactory.InitElements(Driver, this);
     Driver.Manage().Window.Maximize();
 }