Cannot Accept an Alert box at the beginning of page load

I have a feature on my site that an alert box will pop-up to inform user some information when they open a new tab/windows via the navigation bar. When I test it on chrome, the alert box is appear successfully(At this time, the page does not load completely. The page will be loaded after accept the alert), however, the “acceptAlert” build-in Keyword does not work as usual. How can I accept the Alert box in this case?


The alert box prompt out when a new tab open, in this case the page is not completely rendered. and Katalon studio seems can not handle this alert box then accept it. is there have solution to accept it?
Here is the test step:

screencap.png

screencap1.png

Try adding WebUI.acceptAlert() after opening the browser.


The problem happen at step 6, after I open a new tab, then the alert box prompt out in new tab.
Mate Mrse said:

Try adding WebUI.acceptAlert() after opening the browser.

Also, the WebUI.acceptAlert() does not work.

Untitled1.png

Not sure if it might help, but I had a similar problem with a click-command, where the click would trigger an alert.
It always stated, that it was unable to click on element, as an unexpected alert opened (alert was nonetheless expected and handled the click event).
I could solve it by inserting WebUI.acceptAlert(FailureHandling.OPTIONAL) before and after the click-command.
You could try to insert an acceptAlert-command before switching the window.