Package org.openqa.selenium

Examples of org.openqa.selenium.Alert.dismiss()


        final Alert alert = driver.switchTo().alert();
        final String alertText = alert.getText();
        if (accept) {
            alert.accept();
        } else {
            alert.dismiss();
        }
        return alertText;
    }

}
View Full Code Here


    driver.get(url);
    WebElement element = driver.findElement(By.id("theForm"));
    element.submit();
    Alert alert = driver.switchTo().alert();
    String text = alert.getText();
    alert.dismiss();

    assertEquals("Tasty cheese", text);
  }

  @Test
View Full Code Here

      Alert alert = driver.switchTo().alert();
      String alertText = alert.getText();
      if (acceptNextAlert) {
        alert.accept();
      } else {
        alert.dismiss();
      }
      return alertText;
    } finally {
      acceptNextAlert = true;
    }
View Full Code Here

      return;
    }
    Alert alert = get_current_alert_box();
    if(alert != null) {
      action("Dismissed the javascript popup '" + alert.getText() + "'");
      alert.dismiss();
    }
  }
 
  @Beta
  public void javascript_authentication(String username, String password) {
View Full Code Here

      return;
    }
    Alert alert = get_current_alert_box();
    if(alert != null) {
      action("Dismissed the javascript popup '" + alert.getText() + "'");
      alert.dismiss();
    }
  }
 
  @Beta
  public void javascript_authentication(String username, String password) {
View Full Code Here

      return;
    }
    Alert alert = get_current_alert_box();
    if(alert != null) {
      action("Dismissed the javascript popup '" + alert.getText() + "'");
      alert.dismiss();
    }
  }
 
  @Beta
  public void javascript_authentication(String username, String password) {
View Full Code Here

      el.getAttribute("name");
      Assert.fail("cannot interact while action sheet is opened");
    } catch (UnhandledAlertException e) {
    }
    Alert alert = driver.switchTo().alert();
    alert.dismiss();
  }

  @Test
  public void okCancel() throws Exception {
    By b = By.xpath(actionOKCancel);
View Full Code Here

    By b = By.xpath(actionOKCancel);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = driver.switchTo().alert();
    alert.dismiss();
    try {
      driver.switchTo().alert();
      Assert.fail();
    } catch (NoAlertPresentException e) {
      // ignore
View Full Code Here

    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    Assert.assertEquals(alert.getText(), "<Alert message>");
    alert.dismiss();
    waitForAlertToBeGone();
  }

  private void waitForAlertToBeGone() throws InterruptedException {
    // TODO freynaud dismiss should block until alert is gone.
View Full Code Here

    By b = By.xpath(alertLocator);
    WebElement el = driver.findElement(b);
    el.click();

    Alert alert = waitForAlert(driver);
    alert.dismiss();

    try {
      d.switchTo().alert();
      Assert.fail("alert should be gone.");
    } catch (NoAlertPresentException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.