LoadRunner Code Snippets

From PeformIQ Upgrade
Revision as of 17:52, 16 April 2008 by PeterHarding (talk | contribs) (New page: =Finding Multiple Instances in a Page= Here we are looking for invoices in an invoice list... <pre> //----- At 'Invoice Search Screen' ----------------------------------------- w...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Finding Multiple Instances in a Page

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

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

   web_reg_find("Text=iCMS v3.1.4.07 Invoice List",
      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.auspost.com.au/icms-servlet/icms",
      "Method=POST",
      "RecContentType=text/html",
      "Referer=https://test403d.auspost.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 ----------------------------------------