My application triggers an alert notification after submitting a request and I would like to capture the alert message in the notification using playwright. I have tried the following but still it does not work, Any help here would be appreciated:
My application: The alert captured is shown below
The alert message looks like this
The alert message is a sl-alert as shown here
I have tried the following code but it does not work:
page.onDialog(dialog -> System.out.println(dialog.defaultValue()));
page.click("zero-button:has-text(\'Submit\') >> visible=true");
page.onDialog(alert -> System.out.println(alert.defaultValue()));
page.click("zero-button:has-text(\'Submit\') >> visible=true");
page.onDialog(dialog -> System.out.println(dialog.message()));
page.click("zero-button:has-text(\'Submit\') >> visible=true");
page.onDialog(alert -> System.out.println(alert.message()));
page.click("zero-button:has-text(\'Submit\') >> visible=true");