Occasionally you will find that you need to create a VuGen script for a web application which changes the number of name-value pairs which are sent with a POST request. This tech tip shows you how to handle this situation by dynamically constructing a POST body.
In the example below, you can see that the web_submit_data function for the updateItemsFromSearch request (which adds items to a shopping cart) has six item IDs and six item quantities. The web_subit_data function presents the name-value pairs of the POST request in an easy to read format, but doesn't give too many clues as to how you might handle the case of submitting a varying numbers of item IDs, without writing an if statement and having separate web_submit_data functions for every possible number of items.
Fortunately, there is an easy way to do this. Read on...
web_submit_data("updateItemsFromSearch.do",
"Action=http://www.example.com.au/catalog/updateItemsFromSearch.do",
"Method=POST",
"TargetFrame=",
"RecContentType=text/html",
"Referer=http://www.example.com.au/catalog/search.do?key=0/46EF7F373045033002000000AC193D36",
"Snapshot=t10.inf",
"Mode=HTML",
ITEMDATA,
"Name=sortOption", "Value=PRICE_ASCENDING", ENDITEM,
"Name=pageselect", "Value=10", ENDITEM,
"Name=page", "Value=", ENDITEM,
"Name=itemPageSize", "Value=10", ENDITEM,
"Name=next", "Value=addToBasket", ENDITEM,
"Name=itemkey", "Value=46EF7F373045033002000000AC193D364785F195AFD7401600000000AC193D51", ENDITEM,
"Name=order", "Value=", ENDITEM,
"Name=itemquantity", "Value=1", ENDITEM,
"Name=isExtendedResult", "Value=null", ENDITEM,
"Name=display_scenario", "Value=products", ENDITEM,
"Name=contractkey", "Value=", ENDITEM,
"Name=contractitemkey", "Value=", ENDITEM,
"Name=item[0].itemID", "Value=46EF7F373045033002000000AC193D364785F195AFD7401600000000AC193D51", ENDITEM,
"Name=item[0].quantity", "Value=1", ENDITEM,
"Name=item[1].itemID", "Value=46EF7F373045033002000000AC193D3640EBE620771F00A500000000AC193D52", ENDITEM,
"Name=item[1].quantity", "Value=1", ENDITEM,
"Name=item[2].itemID", "Value=46EF7F373045033002000000AC193D363F4191CB824400F3E1000000AC193D38", ENDITEM,
"Name=item[2].quantity", "Value=1", ENDITEM,
"Name=item[3].itemID", "Value=46EF7F373045033002000000AC193D36464DB497A33B005602000000AC193D51", ENDITEM,
"Name=item[3].quantity", "Value=1", ENDITEM,
"Name=item[4].itemID", "Value=46EF7F373045033002000000AC193D36484A7C7E995A8034E1008000AC193D51", ENDITEM,
"Name=item[4].quantity", "Value=1", ENDITEM,
"Name=item[5].itemID", "Value=46EF7F373045033002000000AC193D36484E990F2564C27EE1008000AC193D35", ENDITEM,
"Name=item[5].quantity", "Value=1", ENDITEM,
LAST);
First, let's take a look at what VuGen actually sends to the web server...
POST /catalog/updateItemsFromSearch.do HTTP/1.1\r\n
Content-Type: application/x-www-form-urlencoded\r\n
Cache-Control: no-cache\r\n
Referer: http://www.example.com.au/catalog/search.do?key=0/46EF7F373045033002000000AC193D36\r\n
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)\r\n
Accept-Encoding: gzip, deflate\r\n
Accept-Language: en-us\r\n
Accept: */*\r\n
Connection: Keep-Alive\r\n
Host: www.example.com.au\r\n
Cookie: JSESSIONID=(J2EE5934700)ID1010337953DB11208117568232223992End; saplb_*=(J2EE5934700)5934753\r\n
Content-Length: 896\r\n
\r\n
sortOption=PRICE_ASCENDING&pageselect=10&page=&itemPageSize=10&next=addToBasket&itemkey=46
EF7F373045033002000000AC193D364785F195AFD7401600000000AC193D51&order=&itemquantity=1&isExt
endedResult=null&display_scenario=products&contractkey=&contractitemkey=&item%5B0%5D.itemI
D=46EF7F373045033002000000AC193D364785F195AFD7401600000000AC193D51&item%5B0%5D.quantity=1&
item%5B1%5D.itemID=46EF7F373045033002000000AC193D3640EBE620771F00A500000000AC193D52&item%5
B1%5D.quantity=1&item%5B2%5D.itemID=46EF7F373045033002000000AC193D363F4191CB824400F3E10000
00AC193D38&item%5B2%5D.quantity=1&item%5B3%5D.itemID=46EF7F373045033002000000AC193D36464DB
497A33B005602000000AC193D51&item%5B3%5D.quantity=1&item%5B4%5D.itemID=46EF7F37304503300200
0000AC193D36484A7C7E995A8034E1008000AC193D51&item%5B4%5D.quantity=1&item%5B5%5D.itemID=46
EF7F373045033002000000AC193D36484E990F2564C27EE1008000AC193D35&item%5B5%5D.quantity=1
As you can see, the name-value pairs that were so easy to read in the web_submit_data function are really just sent as a big blob of text, with each name-value pair separated by an ampersand (&) and some characters URL-encoded (e.g. "[" becomes "%5B").
We can make our VuGen script look more like the actual HTTP request by regenerating the script with web_custom_request selected. Select Tools > Regenerate Script, then select the recording option of URL-based script. Under URL Advanced, select Use web_custom_request only.
You script will now look something like this...
web_custom_request("updateItemsFromSearch.do",
"URL=http://www.example.com.au/catalog/updateItemsFromSearch.do",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.example.com.au/catalog/search.do?key=0/46EF7F373045033002000000AC193D36",
"Snapshot=t207.inf",
"Mode=HTTP",
"Body=sortOption=PRICE_ASCENDING&pageselect=10&page=&itemPageSize=10&next=addToBasket&itemkey=46EF7F373045033002000000AC193D364785F195AFD7401600000000AC193D51&order=&itemquantity=1&isExtendedResult=null&display_scenario=products&contractkey=&contractitemkey=&item%5B0%5D.itemID=46EF7F373045033002000000AC193D364785F195AFD7401600000000AC193D51&item%5B0%5D.quantity=1&item%5B1%5D.itemID=46EF7F373045033002000000AC193D3640EBE620771F00A500000000AC193D52&item%5B1%5D.quantity=1&item%5B2%5D.itemID="
"46EF7F373045033002000000AC193D363F4191CB824400F3E1000000AC193D38&item%5B2%5D.quantity=1&item%5B3%5D.itemID=46EF7F373045033002000000AC193D36464DB497A33B005602000000AC193D51&item%5B3%5D.quantity=1&item%5B4%5D.itemID=46EF7F373045033002000000AC193D36484A7C7E995A8034E1008000AC193D51&item%5B4%5D.quantity=1&item%5B5%5D.itemID=46EF7F373045033002000000AC193D36484E990F2564C27EE1008000AC193D35&item%5B5%5D.quantity=1",
LAST);
The next step is to dynamically construct the string that will be sent as the body argument of the web_custom_request function. Do this by
- Correlate your values using ORD=All (line 4) from the response to your search request (line 15).
- Write a for loop to build a parameter containing your POST body (line 31). Save time by using lr_paramarr functions to extract the values from the parameter array you created with web_reg_save_param("Ord=All", ...).
- Use web_custom_request to send your POST body.
lr_start_transaction("search for product");
// Save all item IDs returned by product search
web_reg_save_param("ItemID_array",
"LB=
This is a useful technique to add to your repertoire.
Tech tips from JDS

Browser Console
Read More

Glide Variables
Read More

Understanding Database Indexes in ServiceNow
Read More

Fast-track ServiceNow upgrades with Automated Testing Framework (ATF)
Read More

Read More

Splunk .conf18
Read More

ServiceNow Catalog Client Scripts: G_Form Clear Values
Read More

Is DevPerfOps a thing?
Read More

The benefits of performance testing with LoadRunner
Read More

Monitoring Atlassian Suite with AppDynamics
Read More

5 quick tips for customising your SAP data in Splunk
Read More

How to maintain versatility throughout your SAP lifecycle
Read More

How to revitalise your performance testing in SAP
Read More

Reserve and import data through Micro Focus ALM
Read More

How to effectively manage your CMDB in ServiceNow
Read More

ServiceNow and single sign-on
Read More

How to customise the ServiceNow Service Portal
Read More

Integrating a hand-signed signature to an Incident Form in ServiceNow
Read More

Integrating OMi (Operations Manager i) with ServiceNow
Read More

Implementing an electronic signature in ALM
Read More

Service portal simplicity
Read More

Learning from real-world cloud security crises
Read More

Static Variables and Pointers in ServiceNow
Read More

Citrix and web client engagement on an Enterprise system
Read More

Understanding outbound web services in ServiceNow
Read More

How to solve SSL 3 recording issues in HPE VuGen
Read More

How to record Angular JS Single Page Applications (SPA)
Read More

Calculating Pacing for Performance Tests
Read More

Vugen and GitHub Integration
Read More

What’s new in LoadRunner 12.53
Read More

Filtered Reference Fields in ServiceNow
Read More

ServiceNow performance testing tips
Read More

Monitor Dell Foglight Topology Churn with Splunk
Read More

Straight-Through Processing with ServiceNow
Read More

Splunk: Using Regex to Simplify Your Data
Read More

ServiceNow Choice List Dependencies
Read More

Tips for replaying RDP VuGen scripts in BSM or LoadRunner
Read More

Incorporating iSPI metric reports into MyBSM dashboard pages
Read More

Using SV contexts to simulate stored data
Read More

What’s new in LoadRunner 12.02
Read More

Recycle Bin for Quality Center
Read More

LoadRunner Correlation with web_reg_save_param_regexp
Read More

LoadRunner 11.52
Read More

QC for Testers – Quiz
Read More

Agile Performance Tuning with HP Diagnostics
Read More

What’s new in HP Service Virtualization 2.30
Read More

Understanding LoadRunner Virtual User Days (VUDs)
Read More

Problems recording HTTPS with VuGen
Read More

Improving the management and efficiency of QTP execution
Read More

Performance testing Oracle WebCenter with LoadRunner
Read More

Generating custom reports with Quality Center OTA using Python
Read More

Asynchronous Communication: Scripting For Cognos
Read More

How to fix common VuGen recording problems
Read More

Monitoring Active Directory accounts with HP BAC
Read More

URL Attachments in Quality Center
Read More

What’s new in LoadRunner 11.00?
Read More

Restore old License Usage stats after upgrading Quality Center
Read More

Changing LoadRunner/VuGen log options at runtime
Read More

Restricting large attachments in Quality Center
Read More

Retrieving Quality Center user login statistics
Read More

A comparison of open source load testing tools
...
Read More

Worst practices in performance testing
Read More

LoadRunner Sales Questions
Read More

LoadRunner Analysis: Hints and tips
Read More

LoadRunner in Windows 7
HP Loadrunner 11 is now available. This new version now natively supports Windows 7 and Windows Server 2008. I ...
Read More

Using the QuickTest Professional “commuter” license
Read More

Installing HP Diagnostics
Read More

Understanding LoadRunner licensing
Read More

VuGen scripting for YouTube video
Read More

Creating a Web + MMS vuser
Read More

Why you should use backwards dates
Read More

How to get the host’s IP address from within VuGen
Read More

VuGen scripting for BMC Remedy Action Request System 7.1
Read More

Unique usernames for BPM scripts
Read More

Mapping drives for LoadRunner Windows monitoring
Read More

VuGen feature requests
Read More

LoadRunner script completion checklist
Read More

Querying Quality Center user roles
Read More

Querying the Quality Center Database
Read More

HPSU 2009 Presentation – Performance Testing Web 2.0
Read More

Scaling HP Diagnostics
Read More

Global variables aren’t really global in LoadRunner
Read More

Client-side certificates for VuGen
Read More

Detect malicious HTML/JavaScript payloads with WebInspect (e.g. ASPROX, Gumblar, Income Iframe)
Read More

VuGen code snippets
Read More

Integrating QTP with Terminal Emulators
Read More

Why you must add try/catch blocks to Java-based BPM scripts
Read More

Querying a MySQL database with LoadRunner
Read More

ANZTB 2009 Presentation: Performance Testing Web 2.0
Read More

How to make QTP “analog mode” steps more reliable
Read More

Testing multiple browsers in a Standardized Operating Environment (SOE)
Read More

DNS-based load balancing for virtual users
Read More

What’s new in LoadRunner 9.50?
Read More

Calculating the difference between two dates or timestamps
Read More

The “is it done yet” loop
Read More

Think time that cannot be ignored
Read More

Understanding aggregate variance within LoadRunner analysis
Read More

Load balancing vusers without a load balancer
Read More

Harvesting file names with VuGen
Read More

Parameterising Unix/Posix timestamps in VuGen
Read More

HP Software trial license periods
Read More

How to handle HTTP POSTs with a changing number of name-value pairs
Read More

VuGen string comparison behaviour
Read More

Persistent data in VuGen with MySQL
Read More

How to write a Performance Test Plan
Read More

Unable to add virtual machine
To get ...
Read More

LoadRunner scripting languages
Read More

WDiff replacement for VuGen
Read More

Testing web services with a standard Web Vuser
Read More

Why your BPM scripts should use Download Filters
Read More

Querying your web server logs
Read More

Importing IIS Logs into SQL Server
Read More

QTP “Uninstall was not completed” problem
Read More

VuGen correlation for SAP Web Dynpro
Read More

How to save $500 on your HP software license
Read More

Testing and monitoring acronyms
Read More

Solving VuGen script generation errors
Read More

An introduction to SiteScope EMS Topology
Read More

Using the BAC JMX Console
Read More
I m trying to build dynamic post body .Below is the code which I ve written in my script. But everytime only the last value is getting printed in the body parameter variable.In the below request body I ‘ve 5 singleselectcheck box.(ex: temp:r1:1:t1:3:singleSelectCheckBox).These selectcheckboxes will vary based on the results displayed by the selection criteria. (value 3 is correlated by the below correlation function).
web_reg_save_param(“cCheckboxID”,”LB=name=\”temp:r1:1:t1:”,”RB=:singleSelectCheckBox\” class=\”xqe\””,”ORD=ALL”,LAST);
for (i=1;i<=lr_paramarr_len("cCheckboxID");i++)
{
x=lr_paramarr_idx("cCheckboxID",i);
lr_save_string(x,"checkboxNum");
lr_save_string(lr_eval_string("&temp:r1:1:t1:{checkboxNum}:singleSelectCheckBox=t&"),"body")
}
But the body is saving only 1 value every time I run the script.Only the last value is saved in the body. I need to append all the values to the body .How can I achieve this?
Below is the dynamic request which will have multpile singleSelectCheckBoxes. I need to make this as a parameter.
Even tried of printing all the values to a file. but even then only the last value is getting printed to the file.
"Body=temp:r1:1:cmbAdminSponsorAssignDoc=0&temp:r1:1:ad_soc2AssignDoc=0&temp:r1:1:soc7=1&temp:r1:1:soc8=0&temp:r1:1:soc1=0&temp:r1:1:soc2=1&_afrFiltertemp_afr_r1_afr_1_afr_t1_afr_c2=&_afrFiltertemp_afr_r1_afr_1_afr_t1_afr_c12=&_afrFiltertemp_afr_r1_afr_1_afr_t1_afr_c3=&_afrFiltertemp_afr_r1_afr_1_afr_t1_afr_c4=&_afrFiltertemp_afr_r1_afr_1_afr_t1_afr_c5=&_afrFiltertemp_afr_r1_afr_1_afr_t1_afr_c6=&_afrFiltertemp_afr_r1_afr_1_afr_t1_afr_c13=&_afrFiltertemp_afr_r1_afr_1_afr_t1_afr_c14=&_afrFiltertemp_afr_r1_afr_1_afr_t1_afr_c15=&temp:r1:1:t1:soc6=2&temp:r1:1:t1:selectAllCheckBox=t&temp:r1:1:t1:1:singleSelectCheckBox=t&temp:r1:1:t1:2:singleSelectCheckBox=t&temp:r1:1:t1:3:singleSelectCheckBox=t&temp:r1:1:t1:4:singleSelectCheckBox=t&temp:r1:1:t1:5:singleSelectCheckBox=t&temp:r1:1:sor1=0&temp:r1:1:soc4=7&temp:r1:1:soc5=0&temp:r1:1:id1=31-Mar-2017
Hi Vamshi,
The above code is replacing the body param with your string over and over – but you want to append, not replace.
Try the following:
web_reg_save_param(“cCheckboxID”,”LB=name=\”temp:r1:1:t1:”,”RB=:singleSelectCheckBox\” class=\”xqe\””,”ORD=ALL”,LAST);
lr_save_string("","body"); // Remove any data from previous iterations
for (i=1;i<=lr_paramarr_len("cCheckboxID");i++)
{
x=lr_paramarr_idx("cCheckboxID",i);
lr_save_string(x,"checkboxNum");
//Include the body parameter so we are appending, not replacing:
lr_save_string(lr_eval_string("{body}&temp:r1:1:t1:{checkboxNum}:singleSelectCheckBox=t&"),"body")
}
could you explain how to create for loop in same iteration with different load distribution of transaction?
Example i want to create 5 transactions with different values (like 15%.25%,10%.20%,30) in one iteration ?
Very nice Example to follow. Thank you Stuart Moncrieff
My code is as follows,
int i;
char *thisValue;
char totalValue[200];
web_reg_save_param_ex(“ParamName=msgId”, “LB=msgId\”:”, “RB=,\”time”,”NotFound=warning”,”Ordinal=All”, LAST);
web_custom_request(………….);
for(i=1; i<= lr_paramarr_len("msgId") ; i++){
thisValue = lr_paramarr_idx("msgId", i);
strcat(totalValue,thisValue);
strcat(totalValue,","); // in order to make form like this: 123, 234, 345, 456, …
web_custom_request("DeleteMessages",
"URL=https://URL……………/inbox?msgids={PARAM}"
,LAST );
Thank you very much for solution. The logic works great for me.
Please help me on this:
I am practising the dynamic handling custom request. Please help me to build the dynamic request mentioned below:
1.
web_custom_request(“accessorieslisting.htm”,
“URL=http://www.khivrajmotors.com/accessorieslisting.htm”,
“Method=POST”,
“Resource=0”,
“RecContentType=text/html”,
“Referer=http://www.khivrajmotors.com/accessories.htm”,
“Snapshot=t96.inf”,
“Mode=HTTP”,
“Body=acc_model={pModel}&acc_variant={pVariant}&fieldChanged=&accessoriesCount={dAccCount}&accessSelected=Gear+Lock+Kit@@+Steering+Cover@@+&accessAmountWODiscount=2000&accessDisAmount=0&finalAccessAmtWithDiscount=2000&accessAmount_1=1490.0&discountAmount_1=0.0%25%3E&finalAccessAmount_1=1490.0&accessories_1=Gear+Lock+Kit&accessAmount_2=510.0&discountAmount_2=0.0%25%3E&finalAccessAmount_2=510.0&accessories_2=Steering+Cover”,
LAST);
2.
web_custom_request(“accessorieslisting.htm”,
“URL=http://www.khivrajmotors.com/accessorieslisting.htm”,
“Method=POST”,
“Resource=0”,
“RecContentType=text/html”,
“Referer=http://www.khivrajmotors.com/accessories.htm”,
“Snapshot=t97.inf”,
“Mode=HTTP”,
“Body=acc_model=540&acc_variant=3091&fieldChanged=&accessoriesCount=4&accessSelected=Body+Graphics@@+Side+Moulding+%28Beeding%29@@+Steering+Cover@@+Styling+Kit@@+&accessAmountWODiscount=27140&accessDisAmount=0&finalAccessAmtWithDiscount=27140&accessAmount_1=2250.0&discountAmount_1=0.0%25%3E&finalAccessAmount_1=2250.0&accessories_1=Body+Graphics&accessAmount_2=1390.0&discountAmount_2=0.0%25%3E&finalAccessAmount_2=1390.0&accessories_2=Side+Moulding+%28Beeding%29&accessAmount_3=510.0&discountAmount_3=”
“0.0%25%3E&finalAccessAmount_3=510.0&accessories_3=Steering+Cover&accessAmount_4=22990.0&discountAmount_4=0.0%25%3E&finalAccessAmount_4=22990.0&accessories_4=Styling+Kit”,
LAST);
From the above mentioned, I have got two different body request. Please advice on how to customize the request for the third body dynamically changing. thanks in advance.
My queries is
web_request_form ,in ITEMDATA section the name is dynamic and keep on changing …based on deleting /adding employee and last employee willl get value which I captured through co-relation.
After looking above example ,it has solved my half problem ,but I am not able to resolve the remaining half of the problem
I am using function last_count and wants to assign last_count value to last employee name.
“Name=SUNIL”, “Value=”, ENDITEM,
“Name=RAJIV”, “Value=”, ENDITEM,
“Name=SURYA”, “Value=”, ENDITEM,
“Name=ANIL”, “Value=15”, ENDITEM,
Any help,most welcome.
Regards
Sunil Dangwal
Adding to above ,I had added script alongwith execution to show ,what exactly is expected:& How I am trying to handle using WEB_CUSTOM_REQUEST
for (i=0;i<lr_paramarr_len("Name");i++)
{
lr_save_string(lr_paramarr_idx("Name",i+1),"NameID");
lr_save_int(i,"NameID");
sprintf(Seq_count,"{Name_%d}",i+1 );
lr_save_string(lr_eval_string(Seq_count),"Name_value");
lr_save_string(lr_eval_string("{Body}="),"Body");
}
sprintf(Last_count,"{Name_%d}",atoi(lr_eval_string("{Name_count}")));
lr_save_string(lr_eval_string("{Body}={NewcasesValue}"),"Body1");
lr_output_message("The total processor name is %s",lr_eval_string("{Body}"));
Output/RESULT what is am getting after execution is as follow:
Allocation_Processwise.c(160): Notify: Saving Parameter "Body1 = proces_mnalloc:_id102=Allocate&ABHIJEET SHARMA [X1235]_X1235_EMPCASE=&ABHIJEET MORE [X1795]_X1795_EMPCASE=&ABHIJIT APTE [E5747]_E5747_EMPCASE=&ABHIJIT NATH [E5819]_E5819_EMPCASE=&ABHIJIT DONGRE [E5862]_E5862_EMPCASE=&ABHIJIT INGALE [E7162]_E7162_EMPCASE=&JEEDULA KRISHNA [N27]_N27_EMPCASE=&KRISHNA TEST [U5819]_U5819_EMPCASE=&RAJIV VENUGOPAL [E1944]_E1944_EMPCASE=&RAJIV VENUGOPAL [N17]_N17_EMPCASE=&RATNA KISHORE [N116]_N116_EMPCASE=&TEST TESTING [U5822]_U5822_EMPCASE=&TEST TESTING [U5822]_U5822_EMPCASE=19".
What is required ,I need to handle
TEST TESTING [U5822]_U5822_EMPCASE= as it should not be displayed in the list ,but should be displayed
TEST TESTING [U5822]_U5822_EMPCASE=19".
As it is repeating twice ,because I am inserting value in last Name.
For me result should be as follow
Allocation_Processwise.c(160): Notify: Saving Parameter "Body1 = proces_mnalloc:_id102=Allocate&ABHIJEET SHARMA [X1235]_X1235_EMPCASE=&ABHIJEET MORE [X1795]_X1795_EMPCASE=&ABHIJIT APTE [E5747]_E5747_EMPCASE=&ABHIJIT NATH [E5819]_E5819_EMPCASE=&ABHIJIT DONGRE [E5862]_E5862_EMPCASE=&ABHIJIT INGALE [E7162]_E7162_EMPCASE=&JEEDULA KRISHNA [N27]_N27_EMPCASE=&KRISHNA TEST [U5819]_U5819_EMPCASE=&RAJIV VENUGOPAL [E1944]_E1944_EMPCASE=&RAJIV VENUGOPAL [N17]_N17_EMPCASE=&RATNA KISHORE [N116]_N116_EMPCASE=&TEST TESTING [U5822]_U5822_EMPCASE=19".
Do let me know ,how can I tweak my code? to get required output
Regards
Sunil S Dangwal
Thanks for your help ,I am able to get the answer,by tweaking code:
Output Result :
extremely clear post…step by step procedure helped me achieve my goal…mine script working flawlessly…thnks
Hey! Good post indeed! I have just been writing a code for this for the last few minutes.. lamenting my lack of touch with C language, when I happened to see this!
Very helpful. Thanks for the post!
SAMEER RAJIWMALE
Performance Engineer,
CTS.
Hi,
Extremly good post. Helped me a lot in building a successful WEB CUSTOM REQUEST. My script is working nicely..:)..cheers :)
Hi ,
I need help to make URL dynamic which is get to next page.
Details scenario,
1. Have 3 pages.
1st page to 2nd page request occur.
In 2nd page after click on ok button, 1 parameter generated by application, which could not be in any HTML page.
After that that request get by GET method in third page.
So I have to capture that dynamic value generated by application, how can I do that?
What is the quantity value change.
right now all item ID has quantity 1.
what if that value is dynamically change
Hi,
Thanks for the very useful tip.
One note: “Save time by using lr_paramarr functions to extract the values from the parameter array you created with web_reg_find.” likely should end with “… you created with web_reg_save_param(“ItemID_array…” ?
Nice pickup Stan! I have corrected the article.
Cheers,
Stu.
Scott’s solution is quick n dirty work around and does not scale beyond a predefined limit. I’ve been using web_custom_request for generating dynamic name-value pairs and is a very elegant solution.
The code above would be complete if you add “convert=HTML_TO_URL” argument to the web_reg_save_param call that builds ItemID_array, so that the reserved characters like &, ?, @ etc. within the captured values (if any) will be converted to percent encoding.
Thank you for your improvement to my code.
Cheers,
Stuart.
Hi,
Thanks this is a great topic. I have been trying to find a way to get this done without having to change the arguments in the web_submit_data functions whenever the project team asks to change the number of name-value pairs that they want me to run the test with.
Btw, I would like to ask if the lr_paramarr_idx and lr_paramarr_len is a function found in higher LR versions. I have tried looking for it in LR8.1 function library but these functions do not exist. Is there a work-around for this without having to use C string functions? Thanks!
[Stuart’s Reply: Yes, the lr_paramarr functions are fairly recent. They are definitely not in LoadRunner 8.1.4.]
Scott Moore has an alternative solution here: http://www.loadtester.com/vugen-dynamic-data-websubmitdata
This link is changing. The new URL is:
http://northwaysolutions.com/our-work/blog/2009/05/vugen-dynamic-data-in-web_submit_data
Thanks,
Scott
the above link was unavailable…
Hi Scott the above link is change. Can you please update the new link.
Awesome Work !! Thanks Stuart