コード例 #1
0
 /// <summary>
 /// Wait for alert state to be true (exist) / false (not exist) for given timeout
 /// </summary>
 /// <param name="alertState"></param>
 /// <param name="timeOutSeconds"></param>
 public static void WaitForAlertStateToBe(bool alertState, TimeSpan timeOutSecs)
 {
     try
     {
         WebDriverWait wait = new WebDriverWait(DriverInstance.Instance, timeOutSecs);
         wait.Until(ExpectedConditions.AlertState(alertState));
         LoggerInstance.log.Info("Driver explicitly waits " + timeOutSecs + "seconds for alert state to be " + "\"" + alertState + "\".");
     }
     catch (NoAlertPresentException alertNotPresent)
     {
         LoggerInstance.log.Info(alertNotPresent.Message, alertNotPresent);
     }
     catch (WebDriverTimeoutException webdriverTimeOut)
     {
         LoggerInstance.log.Error(webdriverTimeOut.Message, webdriverTimeOut);
     }
     catch (TimeoutException timeOut)
     {
         LoggerInstance.log.Error(timeOut.Message, timeOut);
     }
     catch (Exception e)
     {
         LoggerInstance.log.Error(e.Message, e);
     }
 }
コード例 #2
0
        public void SetNonStopFilter()
        {
            Actions move   = new Actions(driver);
            var     action = move.MoveToElement(FilterViewer).Click(FilterNonstop).Build();

            action.Perform();
            FilterApplier.Click();
            waiter.Until(ExpectedConditions.AlertState(FilterLoaderContainer.FindElements(By.TagName("div")).Count() == 0));
        }
コード例 #3
0
        public void SetTimeFilter()
        {
            Actions move   = new Actions(driver);
            var     action = move.MoveToElement(FilterViewer).DragAndDropToOffset(TimeSelector, 150, 0).Build();

            action.Perform();
            FilterApplier.Click();
            waiter.Until(ExpectedConditions.AlertState(FilterLoaderContainer.FindElements(By.TagName("div")).Count() == 0));
        }
コード例 #4
0
 /// <summary>
 /// Checks for the state of an alert to be as expected
 /// </summary>
 /// <param name="state">True if the alert is to be displayed</param>
 /// <returns>True if the wait terminates with the alert in the correct state</returns>
 public bool WaitForAlertToBeInState(bool state)
 {
     try
     {
         var wait = new WebDriverWait(Driver, Preferences.BaseSettings.Timeout)
                    .Until(ExpectedConditions.AlertState(state));
         if (wait != state)
         {
             throw new Exception("Could not confirm alert state.");
         }
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
コード例 #5
0
ファイル: SetMethods.cs プロジェクト: JTailor87/Specflow
        public static void WaitAlertState(double Time, bool State)
        {
            var wait = new WebDriverWait(Configuration.PropertiesCollection.driver, TimeSpan.FromSeconds(Time));

            wait.Until(ExpectedConditions.AlertState(State));
        }