Skip to main content

AlertActions

Static methods​

onAlert​

This will return IAlertActions which will expose different methods to handle Alerts.

IAlertActions alertActions = AlertActions.onAlert ();

Instance methods​

accept (text)​

This method will enter the text in the prompt, accept the Alert and will return the Alert message.

import static io.github.boykaframework.actions.drivers.AlertActions.onAlert;
. . .
String message = onAlert ().accept ("some text");

accept​

This method will accept the Alert and return the Alert message.

import static io.github.boykaframework.actions.drivers.AlertActions.onAlert;
. . .
String message = onAlert ().accept ();

dismiss​

This method will dismiss the Alert and return the Alert message.

import static io.github.boykaframework.actions.drivers.AlertActions.onAlert;
. . .
String message = onAlert ().dismiss ();

verifyAccept​

This method is used to verify the alert message after accepting the alert.

import static io.github.boykaframework.actions.drivers.AlertActions.onAlert;
. . .
onAlert ().verifyAccept ().isEqualTo ("Swag Labs");

verifyAccept (text)​

This method is used to verify the alert message after entering the text in the prompt and accepting it.

import static io.github.boykaframework.actions.drivers.AlertActions.onAlert;
. . .
onAlert ().verifyAccept ("Sample text").isEqualTo ("Swag Labs");

verifyDismiss​

This method is used to verify the alert message after dismissing the alert.

import static io.github.boykaframework.actions.drivers.AlertActions.onAlert;
. . .
onAlert ().verifyDismiss ().isEqualTo ("Swag Labs");