> ## Documentation Index
> Fetch the complete documentation index at: https://relivai-63.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Handling Pop-ups

> Explains how to manage pop-ups that appear sporadically during use.

***

## 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.

<Note>
  Since the `Close Popup` action may vary depending on the presence of the
  pop-up, <br />
  it's recommended to set **\[Optional]** by **right-clicking the action** > **\[Settings]**
</Note>

## 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](/guide/advanced/custom-action).

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

```jsx theme={null}
// 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.

<Note>
  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. <br />
  You should either set the overlapping `Click on` step to Optional or delete the
  close button step.
</Note>
