'Katalon Recorder - Handle the native popup of the Chrome browser when leaving a form in a test

I’m trying to catch the browser pop in Chrome after trying to leave a form. Indeed when I click on the button “Close” in the form (after filling some fields), a popup appears asking if I’m sure to want to leave the form:

enter image description here

I tried to catch the pop-up and the action when clicking the buttons inside (OK and Cancel) but I didn’t succeed. I tried this steps:

enter image description here

But when I tried to execute it, it's failed: the step assertConfirmationPresent is not executed (and the next steps too).

I think that the focus is lost after that the popup appears. And I don't know how to do the test correctly.

Could you please help me to do that ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source