Package org.openqa.selenium.htmlunit
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 ofAlertforHtmlUnitDriver. Handles JavaScript alert, confirm, prompt, and beforeunload dialogs.- Author:
- Ahmed Ashour, A aftakhov, Ronald Brill
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept()voiddismiss()voidensureUnlocked()Ensures that any active alert is handled according to the configuredUnexpectedAlertBehaviour.StringgetText()voidhandleBrowserCapabilities(org.openqa.selenium.Capabilities capabilities)Configures the behavior for unexpected alerts based on the given capabilities.voidsendKeys(String keysToSend)voidsetAutoAccept(boolean autoAccept)Sets whether alerts should be automatically accepted when the driver is quitting.
-
-
-
Method Detail
-
setAutoAccept
public void setAutoAccept(boolean autoAccept)
Sets whether alerts should be automatically accepted when the driver is quitting.- Parameters:
autoAccept-trueto automatically accept alerts;falseotherwise
-
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:
dismissin interfaceorg.openqa.selenium.Alert
-
accept
public void accept()
- Specified by:
acceptin interfaceorg.openqa.selenium.Alert
-
getText
public String getText()
- Specified by:
getTextin interfaceorg.openqa.selenium.Alert
-
sendKeys
public void sendKeys(String keysToSend)
- Specified by:
sendKeysin interfaceorg.openqa.selenium.Alert
-
ensureUnlocked
public void ensureUnlocked()
Ensures that any active alert is handled according to the configuredUnexpectedAlertBehaviour. If an alert is present and the behavior is notIGNORE, it will be accepted or dismissed. If the behavior indicates notification, anUnhandledAlertExceptionis thrown.- Throws:
org.openqa.selenium.UnhandledAlertException- if an unexpected alert is found and notification is required
-
-