Class HtmlUnitAlert

java.lang.Object
org.openqa.selenium.htmlunit.HtmlUnitAlert
All Implemented Interfaces:
org.openqa.selenium.Alert

public class HtmlUnitAlert extends Object implements org.openqa.selenium.Alert
Provides an implementation of Alert for HtmlUnitDriver. Handles JavaScript alert, confirm, prompt, and beforeunload dialogs.
Author:
Ahmed Ashour, A aftakhov, Ronald Brill
  • Method Details

    • setAutoAccept

      public void setAutoAccept(boolean autoAccept)
      Sets whether alerts should be automatically accepted when the driver is quitting.
      Parameters:
      autoAccept - true to automatically accept alerts; false otherwise
    • handleBrowserCapabilities

      public void handleBrowserCapabilities(org.openqa.selenium.Capabilities capabilities)
      Configures the behavior for unexpected alerts based on the given capabilities.
      Parameters:
      capabilities - the browser capabilities to inspect for unhandled prompt behavior
    • dismiss

      public void dismiss()
      Specified by:
      dismiss in interface org.openqa.selenium.Alert
    • accept

      public void accept()
      Specified by:
      accept in interface org.openqa.selenium.Alert
    • getText

      public String getText()
      Specified by:
      getText in interface org.openqa.selenium.Alert
    • sendKeys

      public void sendKeys(String keysToSend)
      Specified by:
      sendKeys in interface org.openqa.selenium.Alert
    • ensureUnlocked

      public void ensureUnlocked()
      Ensures that any active alert is handled according to the configured UnexpectedAlertBehaviour. If an alert is present and the behavior is not IGNORE, it will be accepted or dismissed. If the behavior indicates notification, an UnhandledAlertException is thrown.
      Throws:
      org.openqa.selenium.UnhandledAlertException - if an unexpected alert is found and notification is required