Beispiel #1
0
    bool isDialogPresent()
    {
        IAlert alert = ExpectedConditions.AlertIsPresent().Invoke(_driver);

        return(alert != null);
    }
Beispiel #2
0
 /// <summary>
 /// Waits for an alert to be visible.
 /// <para />
 /// The default wait timeout is 30 seconds but can be overridden for another value.
 /// </summary>
 /// <param name="element"></param>
 /// <param name="maxTimeoutInSeconds"></param>
 public void WaitForAlertToBeVisible(int maxTimeoutInSeconds = 30)
 {
     try
     {
         new WebDriverWait(driver, TimeSpan.FromSeconds(maxTimeoutInSeconds)).Until(ExpectedConditions.AlertIsPresent());
     }
     catch (Exception e)
     {
         MyLogger.Log.Error($"Failed to wait for alert to be visible. {e.Message}");
         throw e;
     }
 }