Package org.openqa.selenium

Examples of org.openqa.selenium.Alert


    try {
      writeToFile(webdriver.getPageSource(), pageSource);
    } catch (UnhandledAlertException e) {
      if (retryIfAlert) {
        try {
          Alert alert = webdriver.switchTo().alert();
          System.err.println(e + ": " + alert.getText());
          alert.accept();
          savePageSourceToFile(fileName, webdriver, false);
        }
        catch (Exception unableToCloseAlert) {
          System.err.println("Failed to close alert: " + unableToCloseAlert);
        }
View Full Code Here


  public void execute_async_javascript(String script, Object... args) {
    ((JavascriptExecutor) browser.driver()).executeAsyncScript(script, args);
  }
 
  public void javascript_popup_click_ok() {
    Alert alert = get_current_alert_box();
    if(alert != null) {
      action("Accepted the javascript popup '" + alert.getText() + "'");
      alert.accept();
    }
  }
View Full Code Here

  public void javascript_popup_dismiss() {
    if(browser.is_Chrome()) {
      javascript_popup_click_ok();
      return;
    }
    Alert alert = get_current_alert_box();
    if(alert != null) {
      action("Dismissed the javascript popup '" + alert.getText() + "'");
      alert.dismiss();
    }
  }
View Full Code Here

TOP

Related Classes of org.openqa.selenium.Alert

Copyright © 2018 www.massapicom. 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.