---
title: "Bypassing Confirmation Boxes in Transaction Script"
slug: "bypassing-confirmation-boxes-in-transaction-script"
updated: 2025-06-11T14:33:08Z
published: 2025-06-11T14:33:08Z
canonical: "docs.catchpoint.com/bypassing-confirmation-boxes-in-transaction-script"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.catchpoint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bypassing Confirmation Boxes in Transaction Script

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.
![](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/360000500752-mceclip2.png)

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 <a href="https://docs.catchpoint.com/docs/transaction-commands-and-macros#runscript" target="_blank" rel="noopener">runScript</a> command:

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

<img src="https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/4402389983117-Pic_15.png"/>
