Package io.karatelabs.driver
Interface Dialog
- All Known Implementing Classes:
CdpDialog
public interface Dialog
Interface for JavaScript dialogs (alert, confirm, prompt, or beforeunload).
Dialog types:
"alert"- Simple message dialog with OK button"confirm"- Dialog with OK and Cancel buttons"prompt"- Dialog with text input, OK and Cancel buttons"beforeunload"- Dialog shown when leaving page
Phase 8: Extracted as interface to enable multi-backend support.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept()Accept the dialog (click OK/Yes).voidAccept the dialog with input text (for prompt dialogs).voiddismiss()Dismiss the dialog (click Cancel/No).Get the default prompt value (for prompt dialogs).Get the dialog message.getType()Get the dialog type.booleanCheck if this dialog has been handled.
-
Method Details
-
getMessage
String getMessage()Get the dialog message.- Returns:
- the message displayed in the dialog
-
getType
String getType()Get the dialog type.- Returns:
- one of: "alert", "confirm", "prompt", "beforeunload"
-
getDefaultPrompt
String getDefaultPrompt()Get the default prompt value (for prompt dialogs).- Returns:
- the default value for prompt dialogs, or null for other types
-
accept
void accept()Accept the dialog (click OK/Yes). For prompt dialogs, this accepts with an empty string. -
accept
Accept the dialog with input text (for prompt dialogs).- Parameters:
promptText- the text to enter in the prompt (ignored for non-prompt dialogs)
-
dismiss
void dismiss()Dismiss the dialog (click Cancel/No). -
isHandled
boolean isHandled()Check if this dialog has been handled.- Returns:
- true if accept() or dismiss() has been called
-