How do deal with a javascript pop up

I have a JavaScript pop up that comes up every time I take a new case – things breaks my script as it just stops working there – I have used refresh command and it has worked in the past but for some reason does not seem to work perfectly recently.

Is there some other cool way to deal with these?

You will have to inform Katalon of how you want to handle JavaScript Alerts and Confirmations with the commands. From the references:

chooseOkOnNextConfirmation()

Undo the effect of calling chooseCancelOnNextConfirmation. Note that Selenium’s overridden window.confirm() function will normally automatically return true, as if the user had manually clicked OK, so you shouldn’t need to use this command unless for some reason you need to change your mind prior to the next confirmation. After any confirmation, Selenium will resume using the default behavior for future confirmations, automatically returning true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each confirmation.

Take note - every time a confirmation comes up, you must consume it with a corresponding getConfirmation, or else the next selenium operation will fail.

or

chooseCancelOnNextConfirmation()

By default, Selenium’s overridden window.confirm() function will return true, as if the user had manually clicked OK; after running this command, the next call to confirm() will return false, as if the user had clicked Cancel. Selenium will then resume using the default behavior for future confirmations, automatically returning true (OK) unless/until you explicitly call this command for each confirmation.

Take note - every time a confirmation comes up, you must consume it with a corresponding getConfirmation, or else the next selenium operation will fail.

1 Like