Alert, confirm, and prompt dialogs do not appear in test result screenshots

Prev Next

If you check the screenshots in your test results and cannot find a browser dialog that you expected to see, this article explains why this happens and how you can verify dialogs instead.

Symptom

When reviewing the screenshots in a test result, browser dialogs such as alert, confirm, and prompt do not appear, even though the dialog is displayed when performing the same action manually.

Example

The following is an example of an alert dialog displayed in Chrome. Dialogs like this one will not be shown in the screenshots captured during test execution.

Image

Cause

This is expected behavior in Autify Nexus, and there are two reasons for it.

1. Dialogs are closed automatically

In Nexus test runs, if a scenario does not include a step to close a dialog, the dialog is closed automatically as soon as it appears. This prevents the dialog from blocking the rest of the scenario.

The following types of dialogs are subject to this automatic closing:

  • alert dialog (OK)
  • confirm dialog (OK, Cancel)
  • prompt dialog (Text input field, OK, Cancel)

2. Dialogs are not part of the page

These dialogs are system windows controlled by the browser, not DOM elements on the page. Because of this, they are not included in the standard screenshots or DOM-based captures that Autify Nexus takes during test execution.

Solution

Currently, it is not possible to display the dialog itself in screenshots during standard test execution in Autify Nexus.

If you want to confirm that a dialog appears or verify its wording, you can use a Playwright step. With a Playwright step, you can wait for the dialog to appear, retrieve its message, and assert that it matches the expected text.

For detailed instructions and sample code, see Verify the wording of dialogs.