1. Closing Pop-ups

You can recognize and close pop-ups from the system or those generated by external SDKs like Braze.

You can close a pop-up by clicking its Close button.

Since the Close Popup action may vary depending on the presence of the pop-up,
it’s recommended to set [Optional] by right-clicking the action > [Settings]

2. Always Closing Pop-ups

If you always want to close pop-ups when they appear, you can add a pop-up closing function using custom actions.

The following code is an example of a custom action set to always close Braze and custom pop-ups.

// Always close Braze pop-ups
await page.addLocatorHandler(
  page.frameLocator('[title="Modal Message"]').locator(".bz-close-btn"),
  async () => {
    await page
      .frameLocator('[title="Modal Message"]')
      .locator(".bz-close-btn")
      .click();
  }
);

// Always close proprietary pop-ups (matching text "Do not show today")
await page.addLocatorHandler(
  page.locator('//*[text()="Do not show today"]'),
  async () => {
    await page.locator('//*[text()="Do not show today"]').click();
  }
);

These custom actions work best when executed before the Navigate to step.

Try combining the Always Close Pop-ups custom action and the Navigate to step into single action block for optimal use.

If you register a pop-up handler, it may overlap with the Click on step recorded during the recording when you click the Close Popup button.
You should either set the overlapping Click on step to Optional or delete the close button step.