Difference between revisions of "LoadRunner Code Snippets"
Jump to navigation
Jump to search
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...) |
PeterHarding (talk | contribs) |
||
| Line 1: | Line 1: | ||
=Finding Multiple Instances in a Page= | =Finding Multiple Instances in a Page= | ||
| Line 24: | Line 23: | ||
web_submit_data("icms_5", | web_submit_data("icms_5", | ||
"Action=https://test403d. | "Action=https://test403d.xxxx.com.au/icms-servlet/icms", | ||
"Method=POST", | "Method=POST", | ||
"RecContentType=text/html", | "RecContentType=text/html", | ||
"Referer=https://test403d. | "Referer=https://test403d.xxxx.com.au/icms-servlet/icms", | ||
"Snapshot=t22.inf", | "Snapshot=t22.inf", | ||
"Mode=HTTP", | "Mode=HTTP", | ||
Revision as of 17:53, 16 April 2008
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.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 ----------------------------------------