Skip to main content
Version: 7.5.5

Alerts and Native Dialogs

Alerts and native dialogs might appear for different reasons: a user didn't save his work but wants to close the case; mandatory fields are not filled in; value doesn't have correct format, etc. Debugging might be sometimes tricky because alerts and native dialogs are not visible on screenshots taken by a testing framework (but you can easily understand what`s happened by reading an error message).

important

In Test Maker, you need to put the step with the listener that accepts or cancels alerts BEFORE the step that might cause this issue. If an alert appears occasionally, you can just put the method that accepts an alert at the very beginning of your test or in any type of 'before' hooks. In this case, any alert will be accepted as soon as it is visible.

If you don't want to accept ALL alerts, but only perform this action one time per scenario or a given step, use an optional parameter disposeAfterHandling. If it's value === true, the listener will be turned off after the very first usage.

await pega.alert.accept();//will accept ALL alerts

await pega.alert.accept(true);//will handle only ONE alert, then will be dissmissed