Anyone know how to click the 'OK' button on a Confirm Function Pop-Up?

dstuart
Kilo Expert

On several of our 'create' UI Actions, like Create Problem and Create Change, we have added a Confirm() function call, to be sure that the user really wants to create a Problem or a Change Request. And the User needs to click 'OK' to create the PRB/CHG/etc., or 'Cancel' to stay on the current form. 

Does anyone know how, in an ATF test step, to click on the 'OK' button on a Confirm function pop-up? 

I've tried a Click on Modal Button, but the Confirm() pop-up apparently doesn't count as a a 'modal' button. And it's not considered a UI action. I can't create a PRB from an INC, or a CHG, either. That's the largest impediment to my creation of ATF tests. Along with the 'New' button on a Related list... 

Thanks, Dave 

14 REPLIES 14

Tony DiRienzo
Giga Guru

Unfortunately, it is not possible to do what you are wanting to do.  Click on Modal Button refers to a ServiceNow modal.  If you are referring to the javascript Window.confirm() dialog, that is a browser modal, so ServiceNow cannot interact with it, and additional javascript will not run until the user takes an action.

The easiest option is probably to somehow disable the confirm() functionality when you are testing.

(Supporting reference: https://stackoverflow.com/a/38528619)

dstuart
Kilo Expert

Hi Tony, 

Thanks. That's what I figured. The confirm() function is 'built in' to the UI Action scripting, so there's not really a way to disable it. I could code an 'override' (if user name starts with ATF, then...) into the script(s), but that's probably not the best way to go. 

 

Dave 

Dave,

The only other potential solution I have thought of would be to use a custom confirm modal which uses the ServiceNow modal system instead of the browser modal.  The difficulty I would foresee in that would be finding an easy way to delay the onSubmit action until the user takes action.

Sean98
Mega Contributor

yeah...I have the same issue...and disabling is not preferable since you want to mimic the true functionality...It truly limits the potential flow-through testing since, to move to the next level, the risk assessment MUST be completed...