Ajax (Click & Script) Example Script

Caution: Support for the Ajax Click & Script protocol will be discontinued in upcoming versions of LoadRunner and Performance Center.

  • Do not use the Ajax Click & Script protocol for new scripts.

  • We recommend that you migrate your existing Ajax Click & Script scripts to another Web protocol such as TruClient - Web or Web - HTTP/HTML.

    For details on these Web protocols, see Web - HTTP/HTML Protocol or go to the TruClient Help Center (select the relevant version).

VuGen uses the control handler layer to create the effect of an operation on a GUI control. During recording, when encountering one of the supported Ajax controls, VuGen generates a function with an ajax_xxx prefix.

In the following example, a user selected item number 1 (index=1) in an Accordion control. VuGen generated an ajax_accordion function.

web_browser("Accordion.aspx", 
                DESCRIPTION, 
                ACTION, 
                "Navigate=http://labm1app08/AJAX/Accordion/.aspx", 
                LAST);
lr_think_time(5);
    
ajax_accordion("Accordion",
                   DESCRIPTION,
                  "Framework=atlas",
                  "ID=ctl00_SampleContent_MyAccordion",                     
                     ACTION,
                  "UserAction=SelectIndex",
                  "Index=1",
                  LAST);
web_edit_field("free_text_2", 
        "Snapshot=t18.inf", 
        DESCRIPTION, 
        "Type=text", 
        "Name=free_text", 
        ACTION, 
        "SetValue=FILE_PATH",
        LAST);

Note: When you record an Ajax session, VuGen generates standard Click & Script functions for objects that are not one of the supported Ajax controls. In the example above, the word FILE_PATH was typed into an edit box.