Bypassing Confirmation Boxes in Transaction Script

Prev Next

During a web transaction, certain scripted commands may generate a prompt requiring an action by the user. If the user does not make a selection within the prompt, the transaction flow cannot proceed. An example of this is when a user removes an item from a shopping cart on an e-commerce website, and is prompted to confirm that they want to remove the item.

When creating a script where the user must interact with a dialog box, include the following JavaScript code before the code which generates the prompt. This will automatically bypass the confirmation box.

window.confirm = function() {
    return true;
}

The code will set the window to automatically return true for confirmation boxes. In the example from the above screenshot, this is the equivalent of the user clicking on OK.

You can also perform the opposite. Use the following function to effectively select Cancel in the dialog box:

window.confirm = function() {
    return false;
}

Add this code to your script with the runScript command:

runScript(window.confirm=function(){return true;})