Difference between revisions of "LoadRunner Code Snippets"

From PeformIQ Upgrade
Jump to navigation Jump to search
Line 1: Line 1:
[[TOC]]


=Detect a Pattern in a Page=
=Detect a Pattern in a Page=

Revision as of 14:23, 24 November 2008

TOC

Detect a Pattern in a Page

   //-------------------------------------------------------------------------
   // Warning - You are already logged on to the system in the following sessions:

   web_reg_find("Text=You are already logged on to the system",
		 "SaveCount=warning_count", LAST);

   lr_think_time(2);

   web_text_link("Log On", 
		"Snapshot=t3.inf", 
		DESCRIPTION, 
		"Text=Log On", 
		ACTION, 
		"UserAction=Click", 
		LAST);

   lr_end_transaction("login", LR_AUTO);

   sprintf(msgbuf, "Logged in...");
   userLog(msgbuf);

   //-------------------------------------------------------------------------

   if (atoi(lr_eval_string("{warning_count}"))  > 0) { 
      sprintf(msgbuf, "Warning - You are already logged on to the system");
      userLog(msgbuf);
		
      web_text_link("Continue", 
		"Snapshot=t35.inf", 
		DESCRIPTION, 
		"Text=Continue", 
		ACTION, 
		"UserAction=Click", 
		LAST);
    }

   //-------------------------------------------------------------------------

   lr_think_time(3);

   lr_start_transaction("CreateBid");

   web_text_link("CreateBid", 
		"Snapshot=t4.inf", 
		DESCRIPTION, 
		"Text=Create Bid", 
		"FrameName=menu", 
		ACTION, 
		"UserAction=Click", 
		LAST);

   lr_end_transaction("CreateBid", LR_AUTO);

   sprintf(msgbuf, "CreateBid done...");
   userLog(msgbuf);

   //-------------------------------------------------------------------------
   // <input type="hidden" name="MessLine" value="No longer possible to process any bids for this bid invitation">

   lr_think_time(3);

   web_reg_find("Text=value=\"No longer possible to process any bids for this bid invitation",
				 "SaveCount=alert_count", LAST);
   lr_start_transaction("select_93");

   web_text_link("select_93", 
		"Snapshot=t5.inf", 
		DESCRIPTION, 
		"Text=93", 
		"FrameName=IACFrame", 
		ACTION, 
		"UserAction=Click", 
		LAST);

   lr_end_transaction("select_93", LR_AUTO);

   sprintf(msgbuf, "select_93 done...");
   userLog(msgbuf);

   //-------------------------------------------------------------------------

   if (atoi(lr_eval_string("{alert_count}"))  > 0) { 
      sprintf(msgbuf, "No longer possible to process any bids for this bid invitation");
      userLog(msgbuf);
      return 0;
   }

Find and Extract Multiple Instances in a Page

Here we are looking for invoices in an invoice list...

   //----- At 'Invoice Search Screen' -----------------------------------------

   web_reg_find("Text=XXXX",
      LAST);

   web_reg_save_param("pageID",
                      "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                      "RB=\"",
                      LAST);

   // Look for lines like "<!------------------------ Invoice 427738 ---"

   web_reg_save_param("invoice",
                      "LB=!------------------------ Invoice ",
                      "RB= ---",
                      "ORD=ALL",
                      LAST);

   web_submit_data("icms_5",
      "Action=https://test403d.xxxx.com.au/icms-servlet/icms",
      "Method=POST",
      "RecContentType=text/html",
      "Referer=https://test403d.xxxx.com.au/icms-servlet/icms",
      "Snapshot=t22.inf",
      "Mode=HTTP",
      ITEMDATA,
      "Name=pageID",               "Value={pageID}",     ENDITEM,
      "Name=tfLastName",           "Value=A",            ENDITEM,
      "Name=tfFirstName",          "Value=",             ENDITEM,
      "Name=tfEmployeeNumber",     "Value=",             ENDITEM,
      "Name=listCompanies",        "Value=",             ENDITEM,
      "Name=listManagementUnits",  "Value=",             ENDITEM,
      "Name=tfAccountNumber",      "Value=",             ENDITEM,
      "Name=tfInvoiceNumber",      "Value=",             ENDITEM,
      "Name=rbInvoiceStatus",      "Value=Y",            ENDITEM,
      "Name=listExpenseStatuses",  "Value=1",            ENDITEM,
      "Name=listPeriods763",       "Value=",             ENDITEM,
      "Name=listPeriods762",       "Value=",             ENDITEM,
      "Name=rbResultFormat",       "Value=InvoiceList",  ENDITEM,
      "Name=btnSearch",            "Value=Search",       ENDITEM,
      LAST);


   //----- At 'Invoice List' page - <Go> to view invoice ----------------------

   no_invoices = atoi(lr_eval_string('{invoice_count}'));

   for (i = 1; i < no_invoices; i++) {
      sprintf(invoice_param_str, "{invoice_%s}", i);
	  sprintf(invoice_no, lr_eval_string(invoice_param_str));

      ViewInvoice(invoice_no)
   }

   //----- Back at 'Invoice List' page ----------------------------------------

Page Content Detection Logic

#include "web_api.h"


CodeExpenses()
{
   int unsubmitted         = 0;
   int do_submit           = FALSE;
   int next                = 0;
   int no_expenses         = 0;
   int expenses_remaining  = 0;
   int submit_cnt          = 0;
   int ignore              = 0;

   sprintf(msgbuf, ">>>>> New ITERATION using [%s] <<<<<", lr_eval_string("{Username}"));
   userLog(msgbuf);

   //----- At 'Invoice List' page --------------------------------------------

    web_reg_find("Text=XXXX", LAST);

   lr_start_transaction("Login");

    web_submit_data("Login Page",
        "Action={Protocol}://{System}/icms-servlet/icms",
        "Method=POST",
        "RecContentType=text/html",
        "Referer={Protocol}://{System}/icms-servlet/icms?pageID=0&LanguageID=242&Licensee=xxxxx",
        "Snapshot=t5.inf",
        "Mode=HTTP",
        ITEMDATA,
        "Name=pageID",      "Value=0",          ENDITEM,
        "Name=LanguageID",  "Value=242",        ENDITEM,
        "Name=Licensee",    "Value=xxxxx",      ENDITEM,
        "Name=Username",    "Value={Username}", ENDITEM,
        "Name=Password",    "Value={Username}", ENDITEM,
        "Name=OK",          "Value=   OK   ",   ENDITEM,
        LAST);

   lr_end_transaction("Login", LR_AUTO);

   sprintf(msgbuf, "              Username:  [%s]", lr_eval_string("{Username}"));
   userLog(msgbuf);

    sprintf(msgbuf, "Host - %s  Name - %s",
         lr_eval_string("{System}"),
         lr_eval_string("{Username}"));
   userLog(msgbuf);

    //----- At 'Invoice Search Screen' ----------------------------------------

    web_reg_find("Text=XXXX", LAST);

    // Look for lines like "<!------------------------ Invoice 427738 ---"

    web_reg_save_param("pageID",
                       "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                       "RB=\"",
                       LAST);

   web_reg_save_param("invoice",
                  "LB=----- Invoice ",
                  "RB= -----",
                  "ORD=ALL",
                  LAST);

   web_reg_save_param("InvoiceID",
                  "LB=input type=\"hidden\" name=\"InvoiceID\" value=\"",
                  "RB=\"",
                  LAST);

   lr_start_transaction("InvoiceList");

    web_submit_data("TO: 'Invoice List'",
        "Action={Protocol}://{System}/icms-servlet/icms",
        "Method=POST",
        "RecContentType=text/html",
        "Referer={Protocol}://{System}/icms-servlet/icms",
        "Snapshot=t9.inf",
      "Mode=HTTP",
      ITEMDATA,
        "Name=pageID",  "Value=0",   ENDITEM,
        "Name=btnOk",   "Value=OK",  ENDITEM,
        LAST);

   lr_end_transaction("InvoiceList", LR_AUTO);

   sprintf(msgbuf, "             InvoiceID:  [%s]", lr_eval_string("{InvoiceID}"));
    userLog(msgbuf);

   lr_think_time( 5 );


    //----- At 'Invoice List' page - <Go> to view invoice ---------------------

    web_reg_find("Text=XXXX", LAST);

    web_reg_save_param("pageID",
                       "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                       "RB=\"",
                       LAST);

   // This lives here -  <input type="hidden" name="ExpenseID" value="1111111"/>\r\n

    web_reg_save_param("ExpenseID",
                       "LB=input type=\"hidden\" name=\"ExpenseID\" value=\"",
                       "RB=\"",
                       LAST);

   lr_start_transaction("View_InvoiceDetails");

    web_submit_data("View_InvoiceDetails",
        "Action={Protocol}://{System}/icms-servlet/icms",
        "Method=POST",
        "RecContentType=text/html",
        "Referer={Protocol}://{System}/icms-servlet/icms",
        "Snapshot=t14.inf",
        "Mode=HTTP",
        ITEMDATA,
        "Name=pageID",           "Value={pageID}",    ENDITEM,
        "Name=InvoiceID",        "Value={InvoiceID}", ENDITEM,
        "Name=ddInvoiceAction",  "Value=View",        ENDITEM,
        "Name=btnGo",            "Value=Go",          ENDITEM,
        LAST);

   lr_end_transaction("View_InvoiceDetails", LR_AUTO);

   sprintf(msgbuf, "             ExpenseID:  [%s]", lr_eval_string("{ExpenseID}"));
    userLog(msgbuf);

   lr_think_time( 5 );


    //--------------------------------------------------------------------------

    web_reg_find("Text=XXXX", LAST);

    web_reg_save_param("pageID",
                       "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                       "RB=\"",
                       LAST);

    web_reg_save_param("AccountHolderID",
                       "LB=input type='hidden' name='AccountHolderID' value='",
                       "RB='",
                       LAST);

    web_reg_save_param("ExpenseCount",
                       "LB=input type=\"hidden\" name=\"ExpenseCount\" value=\"",
                       "RB=\"",
                       LAST);

    web_reg_save_param("ExpenseNumber",
                       "LB=input type=\"hidden\" name=\"ExpenseNumber\" value=\"",
                       "RB=\"",
                       LAST);

   web_reg_find("Text=Submitted",         "SaveCount=submitted_count", LAST);
   web_reg_find("Text=Information Only",  "SaveCount=infoonly_count", LAST);
   web_reg_find("Text=Committed",         "SaveCount=committed_count", LAST);

   lr_start_transaction("CodingFrontend");

   web_submit_data("TO: 'Coding Frontend'",
        "Action={Protocol}://{System}/icms-servlet/icms",
        "Method=POST",
        "RecContentType=text/html",
        "Referer={Protocol}://{System}/icms-servlet/icms",
        "Snapshot=t18.inf",
        "Mode=HTTP",
        ITEMDATA,
        "Name=pageID",     "Value={pageID}",    ENDITEM,
        "Name=InvoiceID",  "Value={InvoiceID}", ENDITEM,
        "Name=ExpenseID",  "Value={ExpenseID}", ENDITEM,
        "Name=Action",     "Value=Details",     ENDITEM,
        "Name=btnGo",      "Value=Go",          ENDITEM,
        LAST);

   lr_end_transaction("CodingFrontend", LR_AUTO);

   sprintf(msgbuf, "             InvoiceID:  [%s]", lr_eval_string("{InvoiceID}"));
   userLog(msgbuf);
   sprintf(msgbuf, "       AccountHolderID:  [%s]", lr_eval_string("{AccountHolderID}"));
   userLog(msgbuf);
   sprintf(msgbuf, "          ExpenseCount:  [%s]", lr_eval_string("{ExpenseCount}"));
   userLog(msgbuf);

    /*
     * We are now in Coding screen and about to use wizard
    */

    lr_think_time( 10 );

    //------ Enter basic data and then run the Wizard -------------------------

   if (atoi(lr_eval_string("{submitted_count}"))  > 0) {
      // Already submitted so lets press NEXT!
      unsubmitted = 0;
   } else {
      unsubmitted = 1;
   }

   if (atoi(lr_eval_string("{infoonly_count}"))  > 0) {
      sprintf(msgbuf, "----- Information Only -----");
      userLog(msgbuf);
      ignore      = 1;
      unsubmitted = 0;
   }

   if (atoi(lr_eval_string("{committed_count}"))  > 0) {
      sprintf(msgbuf, "----- Committed -----");
      userLog(msgbuf);
      ignore      = 1;
      unsubmitted = 0;
   }

   sprintf(msgbuf, "Unsubmitted flag == %d", unsubmitted);
    userLog(msgbuf);

   no_expenses        = atoi(lr_eval_string("{ExpenseCount}"));
   expenses_remaining = atoi(lr_eval_string("{ExpenseCount}"));
   submit_cnt         = 0;

   while (expenses_remaining > 0) {

      sprintf(msgbuf, "         ExpenseNumber:  [%s]", lr_eval_string("{ExpenseNumber}"));
      userLog(msgbuf);
      sprintf(msgbuf, "             ExpenseID:  [%s]", lr_eval_string("{ExpenseID}"));
      userLog(msgbuf);

      next      = TRUE;
      do_submit = FALSE;

      while (next) {
         if (unsubmitted) {
            sprintf(msgbuf, "Running the Wizard on this expense:");
            userLog(msgbuf);
   
            web_reg_find("Text=XXXX", LAST);
   
            web_reg_save_param("pageID",
                           "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                           "RB=\"",
                           LAST);
         
/*            web_reg_save_param("ExpenseNumber",
                           "LB=input type=\"hidden\" name=\"ExpenseNumber\" value=\"",
                           "RB=\"",
                           LAST);
*/
            web_reg_save_param("LastQuestionID",
                           "LB=input type=\"hidden\" name=\"LastQuestionID\" value=\"",
                           "RB=\"",
                           LAST);
         
            web_reg_save_param("LastQuestionTypeID",
                           "LB=input type=\"hidden\" name=\"LastQuestionTypeID\" value=\"",
                           "RB=\"",
                           LAST);
         
         /* WizardAnswer is and array of Radio Buttons ---------------------------------
         
            web_reg_save_param("WizardAnswer",
                           "LB=input type=\"hidden\" name=\"WizardAnswer\" value=\"",
                           "RB=\"",
                           LAST);
         */
         
            web_reg_find("Text=You cannot use the Coding Wizard", "SaveCount=submitted_count", LAST);
         
            lr_continue_on_error(1); 
         
            lr_start_transaction("ToWizard");

            web_submit_data("TO: Wizard'",
               "Action={Protocol}://{System}/icms-servlet/icms",
               "Method=POST",
               "RecContentType=text/html",
               "Referer={Protocol}://{System}/icms-servlet/icms",
               "Snapshot=t22.inf",
               "Mode=HTTP",
               ITEMDATA,
               "Name=pageID",                      "Value={pageID}",                                ENDITEM,
               "Name=AccountHolderID",             "Value={AccountHolderID}",                       ENDITEM,
               "Name=ExpenseID",                   "Value={ExpenseID}",                             ENDITEM,
               "Name=InvoiceID",                   "Value={InvoiceID}",                             ENDITEM,
               "Name=ExpenseCount",                "Value={ExpenseCount}",                          ENDITEM,
               "Name=ExpenseNumber",               "Value={ExpenseNumber}",                         ENDITEM,
               "Name=btnWizard",                   "Value=Wizard",                                  ENDITEM,
               "Name=NavType",                     "Value=null",                                    ENDITEM,
               "Name=ddExpType",                   "Value=921",                                     ENDITEM,
               "Name=rbTaxStatus",                 "Value=Y",                                       ENDITEM,
               "Name=ddDocType",                   "Value=3",                                       ENDITEM,
               "Name=Purpose.tfCode",              "Value=THIS IS THE PURPOSE",                     ENDITEM,
               "Name=Cost Centre.tfCode",          "Value={CostCenter}",                            ENDITEM,
               "Name=Cost Centre.tfDescription",   "Value=",                                        ENDITEM,
               "Name=Expense Code.tfCode",         "Value=",                                        ENDITEM,
               "Name=Expense Code.tfDescription",  "Value=",                                        ENDITEM,
               LAST);
         
            lr_end_transaction("ToWizard", LR_AUTO);

            lr_continue_on_error(0);

            if (atoi(lr_eval_string("{submitted_count}"))  > 0) {
               // Already submitted so lets press NEXT!

               sprintf(msgbuf, "[To Wizard] -> Expense already submitted - Cannot re-run wizard.  Selecting NEXT one!");
               userLog(msgbuf);

               unsubmitted = 0;
            } else {
               sprintf(msgbuf, "[To Wizard] -> OK");
               userLog(msgbuf);

               unsubmitted = 1;
               do_submit   = TRUE;
               next        = 0;
            }
         } else {
            sprintf(msgbuf, "Selecting 'NEXT' expense:");
            userLog(msgbuf);
   
            web_reg_save_param("pageID",
                     "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                     "RB=\"",
                     LAST);
   
            web_reg_save_param("ExpenseNumber",
                           "LB=input type=\"hidden\" name=\"ExpenseNumber\" value=\"",
                           "RB=\"",
                           LAST);
   
            web_reg_save_param("ExpenseID",
                           "LB=input type='hidden' name='ExpenseID' value='",
                           "RB='",
                           LAST);
   
            web_reg_find("Text=ExpenseStatus3\">Submitted", "SaveCount=submitted_count", LAST);
            web_reg_find("Text=ExpenseStatus5\">Information", "SaveCount=infoonly_count", LAST);
            web_reg_find("Text=ExpenseStatus8\">Committed", "SaveCount=comitted_count", LAST);
   
            lr_continue_on_error(1);
   
            lr_start_transaction("NextExpense");

            web_submit_data("TO: 'Next Expense'",
               "Action={Protocol}://{System}/icms-servlet/icms",
               "Method=POST",
               "RecContentType=text/html",
               "Referer={Protocol}://{System}/icms-servlet/icms",
               "Snapshot=t22.inf",
               "Mode=HTTP",
               ITEMDATA,
               "Name=pageID",                      "Value={pageID}",                                ENDITEM,
               "Name=AccountHolderID",             "Value={AccountHolderID}",                       ENDITEM,
               "Name=ExpenseID",                   "Value={ExpenseID}",                             ENDITEM,
               "Name=InvoiceID",                   "Value={InvoiceID}",                             ENDITEM,
               "Name=ExpenseCount",                "Value={ExpenseCount}",                          ENDITEM,
               "Name=ExpenseNumber",               "Value={ExpenseNumber}",                         ENDITEM,
               "Name=btnNext",                     "Value=Next",                                    ENDITEM,
               "Name=NavType",                     "Value=null",                                    ENDITEM,
               "Name=ddExpType",                   "Value=921",                                     ENDITEM,
               "Name=rbTaxStatus",                 "Value=Y",                                       ENDITEM,
               "Name=ddDocType",                   "Value=3",                                       ENDITEM,
               "Name=Purpose.tfCode",              "Value=",                                        ENDITEM,
               "Name=Cost Centre.tfCode",          "Value=",                                        ENDITEM,
               "Name=Cost Centre.tfDescription",   "Value=",                                        ENDITEM,
               "Name=Expense Code.tfCode",         "Value=",                                        ENDITEM,
               "Name=Expense Code.tfDescription",  "Value=",                                        ENDITEM,
               LAST);
   
            lr_end_transaction("NextExpense", LR_AUTO);

            lr_continue_on_error(0);

            if (atoi(lr_eval_string("{infoonly_count}"))  > 0) {
               sprintf(msgbuf, "----- Information Only -----");
               userLog(msgbuf);
               ignore      = 1;
               unsubmitted = 0;
            }

            if (atoi(lr_eval_string("{committed_count}"))  > 0) {
               sprintf(msgbuf, "----- Committed -----");
               userLog(msgbuf);
               ignore      = 1;
               unsubmitted = 0;
            }

            if (atoi(lr_eval_string("{submitted_count}"))  > 0) {
               // Already submitted so lets press NEXT!

               sprintf(msgbuf, "[NEXT] -> Expense already submitted.  Selecting NEXT one!");
               userLog(msgbuf);

               unsubmitted = 0;
            } else {
               sprintf(msgbuf, "[NEXT] -> Expense not submitted");
               userLog(msgbuf);

               unsubmitted = 1;
            }
      
            lr_think_time( 1 );

            expenses_remaining = atoi(lr_eval_string("{ExpenseCount}")) - atoi(lr_eval_string("{ExpenseNumber}"));
   
            if (!unsubmitted && (expenses_remaining == 0)) {
               next = 0;
            }

            sprintf(msgbuf, "         ExpenseNumber:  [%s] --> %d remaining",
                  lr_eval_string("{ExpenseNumber}"), expenses_remaining);
            userLog(msgbuf);
            sprintf(msgbuf, "             ExpenseID:  [%s]", lr_eval_string("{ExpenseID}"));
            userLog(msgbuf);
         }
      }
   

      if (do_submit) {  // Go through the wizard...
         sprintf(msgbuf, "        LastQuestionID:  [%s]", lr_eval_string("{LastQuestionID}"));
         userLog(msgbuf);
         sprintf(msgbuf, "    LastQuestionTypeID:  [%s]", lr_eval_string("{LastQuestionTypeID}"));
         userLog(msgbuf);
   
         lr_think_time( 5 );
   
   
         //----- In the Wizard ---------------------------------------------
      
         web_reg_find("Text=XXXX", LAST);
      
         web_reg_save_param("pageID",
                        "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                        "RB=\"",
                        LAST);
   
      /*
         WizardAnswer [RadioButton] values:
      
           1984 - Meals and Entertainment
           1985 - Allowances (FBT)
           1986 - Subscriptions
           1987 - Achievement Awards
           1988 - Education Costs
           1989 - Drivers License
           1990 - Uniforms
           1991 - Telephone Charges
           1992 - Toll Fees
      */
   
         lr_start_transaction("Wizard_1");

         web_submit_data("Wizard_1",
            "Action={Protocol}://{System}/icms-servlet/icms",
            "Method=POST",
            "RecContentType=text/html",
            "Referer={Protocol}://{System}/icms-servlet/icms",
            "Snapshot=t26.inf",
            "Mode=HTTP",
            ITEMDATA,
            "Name=pageID",              "Value={pageID}",  ENDITEM,
            "Name=LastQuestionID",      "Value=2531",      ENDITEM,
            "Name=LastQuestionTypeID",  "Value=1",         ENDITEM,
            "Name=WizardAnswer",        "Value=1983",      ENDITEM,
            "Name=btnNext",             "Value=Next",      ENDITEM,
            LAST);
      
         lr_end_transaction("Wizard_1", LR_AUTO);

         lr_think_time( 1 );
   
         //-----------------------------------------------------------------
   
         web_reg_find("Text=XXXX", LAST);
   
         web_reg_save_param("pageID",
                        "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                        "RB=\"",
                        LAST);
   
         lr_start_transaction("Wizard_2");

         web_submit_data("Wizard_2",
            "Action={Protocol}://{System}/icms-servlet/icms",
            "Method=POST",
            "RecContentType=text/html",
            "Referer={Protocol}://{System}/icms-servlet/icms",
            "Snapshot=t30.inf",
            "Mode=HTTP",
            ITEMDATA,
            "Name=pageID",              "Value={pageID}",  ENDITEM,
            "Name=LastQuestionID",      "Value=2532",      ENDITEM,
            "Name=LastQuestionTypeID",  "Value=1",         ENDITEM,
            "Name=WizardAnswer",        "Value=1993",      ENDITEM,
            "Name=btnNext",             "Value=Next",      ENDITEM,
            LAST);
   
         lr_end_transaction("Wizard_2", LR_AUTO);

         lr_think_time( 1 );
   
         //-----------------------------------------------------------------
      
         web_reg_find("Text=XXXX", LAST);
      
         web_reg_save_param("pageID",
                        "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                        "RB=\"",
                        LAST);
      
         lr_start_transaction("Wizard_3");

         web_submit_data("Wizard_3",
            "Action={Protocol}://{System}/icms-servlet/icms",
            "Method=POST",
            "RecContentType=text/html",
            "Referer={Protocol}://{System}/icms-servlet/icms",
            "Snapshot=t34.inf",
            "Mode=HTTP",
            ITEMDATA,
            "Name=pageID",              "Value={pageID}",  ENDITEM,
            "Name=LastQuestionID",      "Value=2533",      ENDITEM,
            "Name=LastQuestionTypeID",  "Value=1",         ENDITEM,
            "Name=WizardAnswer",        "Value=2005",      ENDITEM,
            "Name=btnNext",             "Value=Next",      ENDITEM,
            LAST);
      
         lr_end_transaction("Wizard_3", LR_AUTO);

         lr_think_time( 1 );
   
         //-----------------------------------------------------------------
      
         web_reg_find("Text=XXXX", LAST);
      
         web_reg_save_param("pageID",
                        "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                        "RB=\"",
                        LAST);
      
         lr_start_transaction("Wizard_4");

         web_submit_data("Wizard_4",
            "Action={Protocol}://{System}/icms-servlet/icms",
            "Method=POST",
            "RecContentType=text/html",
            "Referer={Protocol}://{System}/icms-servlet/icms",
            "Snapshot=t38.inf",
            "Mode=HTTP",
            ITEMDATA,
            "Name=pageID",              "Value={pageID}",            ENDITEM,
            "Name=LastQuestionID",      "Value=2536",                ENDITEM,
            "Name=LastQuestionTypeID",  "Value=2",                   ENDITEM,
            "Name=btnNext",             "Value=Next",                ENDITEM,
            "Name=taSplits",            "Value={FirstName} tester",  ENDITEM,
            "Name=cbAutoSplit",         "Value=on",                  ENDITEM,
            LAST);
      
         lr_end_transaction("Wizard_4", LR_AUTO);

         lr_think_time( 1 );

         //-----------------------------------------------------------------

         web_reg_find("Text=XXXX", LAST);

         web_reg_save_param("pageID",
                        "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                        "RB=\"",
                        LAST);

         lr_start_transaction("Wizard_5");

         web_submit_data("Wizard_5",
            "Action={Protocol}://{System}/icms-servlet/icms",
            "Method=POST",
            "RecContentType=text/html",
            "Referer={Protocol}://{System}/icms-servlet/icms",
            "Snapshot=t42.inf",
            "Mode=HTTP",
            ITEMDATA,
            "Name=pageID",              "Value={pageID}",  ENDITEM,
            "Name=LastQuestionID",      "Value=2540",      ENDITEM,
            "Name=LastQuestionTypeID",  "Value=1",         ENDITEM,
            "Name=btnNext",             "Value=Next",      ENDITEM,
            "Name=WizardAnswer",        "Value=2089",      ENDITEM,
            LAST);

         lr_end_transaction("Wizard_5", LR_AUTO);

         lr_think_time( 1 );

         //----- Finish in the Wizard --------------------------------------

         web_reg_find("Text=XXXX", LAST);

         web_reg_save_param("pageID",
                        "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                        "RB=\"",
                        LAST);

         lr_start_transaction("Wizard_6");

         web_submit_data("Wizard_6",
            "Action={Protocol}://{System}/icms-servlet/icms",
            "Method=POST",
            "RecContentType=text/html",
            "Referer={Protocol}://{System}/icms-servlet/icms",
            "Snapshot=t46.inf",
            "Mode=HTTP",
            ITEMDATA,
            "Name=pageID",              "Value={pageID}",  ENDITEM,
            "Name=LastQuestionID",      "Value=0",         ENDITEM,
            "Name=LastQuestionTypeID",  "Value=9",         ENDITEM,
            "Name=btnFinish",           "Value=Finish",    ENDITEM,
            LAST);
   
         lr_end_transaction("Wizard_6", LR_AUTO);

         lr_think_time( 1 );

         // Should now see Submitted (with yellow background) on summary page!

         unsubmitted = 0;
      }

      lr_think_time( 2 );
   }



    //------ Close the page and back out ---------------------------------------

    web_reg_find("Text=XXXX", LAST);

    web_reg_save_param("pageID",
                       "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                       "RB=\"",
                       LAST);

   lr_start_transaction("Close_ExpenseCodingScreen");

   web_submit_data("Close_ExpenseCodingScreen",
        "Action={Protocol}://{System}/icms-servlet/icms",
        "Method=POST",
        "RecContentType=text/html",
        "Referer={Protocol}://{System}/icms-servlet/icms",
        "Snapshot=t50.inf",
        "Mode=HTTP",
        ITEMDATA,
        "Name=pageID",           "Value={pageID}",          ENDITEM,
        "Name=AccountHolderID",  "Value={AccountHolderID}", ENDITEM,
        "Name=ExpenseID",        "Value={ExpenseID}",       ENDITEM,
        "Name=InvoiceID",        "Value={InvoiceID}",       ENDITEM,
        "Name=ExpenseCount",     "Value={ExpenseCount}",    ENDITEM,
        "Name=ExpenseNumber",    "Value={ExpenseNumber}",   ENDITEM,
        "Name=btnClose",         "Value=Close",             ENDITEM,
        "Name=NavType",          "Value=null",              ENDITEM,
        LAST);

   lr_end_transaction("Close_ExpenseCodingScreen", LR_AUTO);

    /*
     * Now have a yellow 'S!!!!
     */

   lr_think_time( 1 );


    //--------------------------------------------------------------------------

    web_reg_find("Text=XXXX", LAST);

    web_reg_save_param("pageID",
                       "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                       "RB=\"",
                       LAST);

   lr_start_transaction("Close_InvoiceDetails");

    web_submit_data("Close_InvoiceDetails",
        "Action={Protocol}://{System}/icms-servlet/icms",
        "Method=POST",
        "RecContentType=text/html",
        "Referer={Protocol}://{System}/icms-servlet/icms",
        "Snapshot=t54.inf",
        "Mode=HTTP",
        ITEMDATA,
        "Name=pageID",     "Value={pageID}",    ENDITEM,
        "Name=InvoiceID",  "Value={InvoiceID}", ENDITEM,
        "Name=btnClose",   "Value=Close",       ENDITEM,
        LAST);

   lr_end_transaction("Close_InvoiceDetails", LR_AUTO);

   lr_think_time( 1 );


    //--------------------------------------------------------------------------

    web_reg_find("Text=XXXX",
        LAST);

    web_reg_save_param("pageID",
                       "LB=input type=\"hidden\" name=\"pageID\" value=\"",
                       "RB=\"",
                       LAST);

   lr_start_transaction("Close_InvoiceList");

    web_submit_data("Close_InvoiceList",
        "Action={Protocol}://{System}/icms-servlet/icms",
        "Method=POST",
        "RecContentType=text/html",
        "Referer={Protocol}://{System}/icms-servlet/icms",
        "Snapshot=t59.inf",
        "Mode=HTTP",
        ITEMDATA,
        "Name=pageID",       "Value={pageID}",  ENDITEM,
        "Name=ResultsPage",  "Value=0",         ENDITEM,
        "Name=btnClose",     "Value=Close",     ENDITEM,
        LAST);

   lr_end_transaction("Close_InvoiceList", LR_AUTO);

   lr_think_time( 1 );


    //--------------------------------------------------------------------------

    web_reg_find("Text=XXXX", LAST);

   lr_start_transaction("Close_FlashPage");

   web_submit_data("Close_FlashPage",
        "Action={Protocol}://{System}/icms-servlet/icms",
        "Method=POST",
        "RecContentType=text/html",
        "Referer={Protocol}://{System}/icms-servlet/icms",
        "Snapshot=t63.inf",
        "Mode=HTTP",
        ITEMDATA,
        "Name=pageID",  "Value={pageID}",  ENDITEM,
        "Name=btnOk",   "Value=OK",        ENDITEM,
        LAST);

   lr_end_transaction("Close_FlashPage", LR_AUTO);

   lr_think_time( 1 );


    //--------------------------------------------------------------------------

    web_reg_find("Text=XXXX", LAST);

   lr_start_transaction("Logoff");

    web_url("Log off",
        "URL={Protocol}://{System}/icms-servlet/icms/Logout?LanguageID=242&Licensee=xxxx",
        "Resource=0",
        "RecContentType=text/html",
        "Referer={Protocol}://{System}/icms-servlet/icms",
        "Snapshot=t68.inf",
        "Mode=HTTP",
        LAST);

   lr_end_transaction("Logoff", LR_AUTO);

   lr_think_time( 1 );


    //--------------------------------------------------------------------------

    return 0;
}  // CodeExpenses