AJAX support

HCL OneTest UI supports testing AJAX-based web applications.

You can test AJAX-based applications in two different ways; by setting the Auto Trace option to true or by setting the Auto Trace option to false.

APIs for testing AJAX-based applications

The following APIs can be used in functional test scripts for testing AJAX-based applications. These APIs must be invoked on the HTML.Document test objects.
Method Description Example
SetAjaxTrace(boolean) To trace the AJAX requests on the Document control document_htmlDocument().setAjaxTrace(true);
GetAjaxPendingRequests () Returns the number of AJAX pending requests at any given point of time since the first AjaxTraceOn.
document_htmlDocument().getAjaxPendingRequests();
WaitForAjaxPendingRequests (int) To wait for the specified number of AJAX requests to be completed. Waits indefinitely till pending requests becomes zero, if the argument is not specified. document_htmlDocument().waitForAjaxPendingRequests(2);
GetAjaxCompletedRequests () Returns the number of AJAX requests completed at any given point of time since the first AjaxTraceOn.. document_htmlDocument().getAjaxCompletedRequests();
WaitForAjaxCompletedRequests (int) To wait for the specified number of Ajax requests to be completed. document_htmlDocument().waitForAjaxCompletedRequests(4);
Note: For more information on these APIs, see the API Reference topics.