Anyone know how to click the 'OK' button on a Confirm Function Pop-Up?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2018 09:42 AM
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
- Labels:
-
Automated Test Framework
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2020 11:43 AM
I am also facing the same issue, I have a pop-up message that needs to be confirmed before moving forward. Has anyone figured out a solution to this? Ideally, I want to be able to hit ok and move on.
ServiceNow can you please code some magic so we can test this confirm popup alert box by an ATF test step.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2020 06:55 AM
Hi Luis,
When you run your test is the confirm dialog appearing? Alert and Confirmation dialogs should be handled by the Client Test Runner according to the documentation here https://docs.servicenow.com/bundle/orlando-application-development/page/administer/auto-test-framewo...
Javascript window command intercepts
The Client Test Runner captures window object commands including console.log, console.error, alert, confirm, and prompt, with default responses where necessary.
- Any script that calls window.confirm receives a boolean response of true.
- Any script that calls window.prompt receives the string response test value.
We have some alert and confirmation messages that appear when we manually perform an action, but these messages do not appear in ATF.
Hope this helps.
Thanks,
Cody
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2020 09:10 AM
Yes the confirm dialog message does appear, when I run the ATF test but adding a step to click on the "OK" button so I can move forward with my flow is where I'm stuck.
As test steps "Click on Modal Button, Click a UI action and Click on Component (Custom UI)" doesn't seem to do the trick either.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2020 01:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2020 01:50 PM
Hi Cody,
My dialog message is the same as your 2nd screenshot(browser dialog)