Tracing AJAX requests

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 on the corresponding document object. By setting Auto Trace option to true, you can trace the AJAX requests.

The following example shows how to use the getAjaxPendingRequests and waitForAjaxCompletedRequests. The getAjaxPendingRequeststo method is used to return the number of AJAX pending requests at any given point of time since the first AjaxTraceOn. The waitForAjaxCompletedRequestsTo methos is used to wait for the specified number of AJAX requests to be completed. If the argument is not specified, it waits till the pending requests becomes zero.

import resources.Script1Helper;
import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.object.interfaces.SAP.*;
import com.rational.test.ft.object.interfaces.WPF.*;
import com.rational.test.ft.object.interfaces.dojo.*;
import com.rational.test.ft.object.interfaces.siebel.*;
import com.rational.test.ft.object.interfaces.flex.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;

 * Description   : Functional Test Script
 * @author administrator
public class Script1 extends Script1Helper
   * Script Name   : Script1
   * Generated     : Apr 27, 2008 5:05:17 PM
   * Description   : Functional Test Script
   * Original Host : WinNT Version 5.1  Build 2600 (S)
   * @since  2008/04/27
   * @author administrator
  public void testMain(Object[] args) 
    int pendReqsts = document_htmlDocument().getAjaxPendingRequests();