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

Prev Next

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()" (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.

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.

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 action is used in conjunction with a "waitFor" action, such as waitForElementPresent or waitForUrl or waitForNoRequest, so the agent has something other than document complete to indicate that it can continue with the next action of the step.