---
title: "AJAX in Transaction Tests"
slug: "ajax-in-transaction-tests"
updated: 2025-06-11T14:38:56Z
published: 2025-06-11T14:38:56Z
---

> ## 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.

# AJAX in Transaction Tests

## Overview

For Transaction tests, our agent waits for the **Document Complete** event before continuing each action listed under a step. This ensures that all referenced elements are present on a page. This behavior can cause problems on pages that use AJAX, as the agent is not loading a new page for each step. In these cases, the agent may end up waiting for a **Document Complete** that will never occur.

## Workaround

To address this, we added a custom action "[ignoreDocComplete()](https://docs.catchpoint.com/docs/transaction-commands-and-macros#ignoredoccomplete)" (not present in Selenium)

Here is an example of an AJAX use case with Google search. When a user clicks the "Google Search" button the agent will load a new webpage, hence a "Document Complete" will fire.

![](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/200934775-google1.png)

However, when performing filtering on the results page -- say, viewing items from the "Past week" -- the page refreshes using AJAX, and there is **no** Document Complete event.

![](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/200884319-Untitled.png)

For this example, the search refinement results are AJAX, and the Transaction script looks like this:

```
` // Step - 1
open(http://www.google.com/)
type(//*[@id='lst-ib'], 'shoe')

// Step - 2
submit(//*[@id="gbqf"])
click(//*[@id='hdtb-tls'])
click(//*[@id="hdtbMenus"]/div/div[2]/div)
ignoreDocComplete()

// Step - 3
clickAndWait(link=regexp:Past hour)
ignoreDocComplete(
waitForUrl("www.google.com/search") `
```

The [ignoreDocComplete](https://docs.catchpoint.com/docs/transaction-commands-and-macros#ignoreDocComplete) action is used in conjunction with a "waitFor" action, such as [waitForElementPresent](https://docs.catchpoint.com/docs/transaction-commands-and-macros#waitForElcodeentPresent) or [waitForUrl](https://docs.catchpoint.com/docs/transaction-commands-and-macros#waitForUrl) or [waitForNoRequest](https://docs.catchpoint.com/docs/transaction-commands-and-macros#waitForNoRequest), so the agent has something other than document complete to indicate that it can continue with the next action of the step.
