예제 #1
0
 private String closeAlertAndGetItsText() {
   try {
     Alert alert = driver.switchTo().alert();
     String alertText = alert.getText();
     if (acceptNextAlert) {
       alert.accept();
     } else {
       alert.dismiss();
     }
     return alertText;
   } finally {
     acceptNextAlert = true;
   }
 }
예제 #2
0
 public void cancelAlert() {
   Alert alert = driver.switchTo().alert();
   alert.dismiss();
 }
예제 #3
0
 // handling Alert
 public void okAlert() {
   Alert alert = driver.switchTo().alert();
   alert.accept();
 }