示例#1
0
        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());
        }
示例#2
0
        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();
     }
 }
示例#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);
            }));
        }
示例#5
0
 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()));
 }