Class HandleDialog
java.lang.Object
net.serenitybdd.screenplay.playwright.interactions.HandleDialog
- All Implemented Interfaces:
net.serenitybdd.core.SkipNested,net.serenitybdd.screenplay.Performable
Handle JavaScript dialogs (alert, confirm, prompt).
This interaction sets up a dialog handler that will be triggered when the next dialog appears. Must be called BEFORE the action that triggers the dialog.
Sample usage:
actor.attemptsTo(
HandleDialog.byAccepting(),
Click.on("#trigger-alert")
);
actor.attemptsTo(
HandleDialog.byDismissing(),
Click.on("#trigger-confirm")
);
actor.attemptsTo(
HandleDialog.byEntering("some text"),
Click.on("#trigger-prompt")
);
-
Method Summary
Modifier and TypeMethodDescriptionstatic HandleDialogAccept the next dialog (clicks OK/Accept).static HandleDialogDismiss the next dialog (clicks Cancel/Dismiss).static HandleDialogbyEntering(String text) Enter text into the next prompt dialog and accept it.<T extends net.serenitybdd.screenplay.Actor>
voidperformAs(T actor) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.serenitybdd.screenplay.Performable
then
-
Method Details
-
byAccepting
Accept the next dialog (clicks OK/Accept). -
byDismissing
Dismiss the next dialog (clicks Cancel/Dismiss). -
byEntering
Enter text into the next prompt dialog and accept it. -
performAs
public <T extends net.serenitybdd.screenplay.Actor> void performAs(T actor) - Specified by:
performAsin interfacenet.serenitybdd.screenplay.Performable
-
toString
-