コード例 #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());
        }
コード例 #3
0
 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();
 }
コード例 #6
0
 public void Dispose()
 {
     ReleaseUnmanagedResources();
     GC.SuppressFinalize(this);
     _singleton = null;
 }
コード例 #7
0
 public static WebDriverContext GetInstance()
 {
     return(_singleton ?? (_singleton = new WebDriverContext()));
 }