jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Niemeyer <andreas.nieme...@gutzmann.com>
Subject Re: extract hidden form values and add them to a post request dynamically?
Date Mon, 08 Feb 2010 09:58:30 GMT
Hi,

I tried it as you mentioned and assigned a child beanshell 
pre-processor, the script for that looks quite simple:

int vCount = Integer.parseInt( vars.get("form_values_matchNr"));
String vVarNameKey = null;
String vVarNameVal = null;

for (int i = 1; i <= vCount; i++) {
	vVarNameKey = "form_values_" + i + "_g1";
	vVarNameVal = "form_values_" + i + "_g2";
	sampler.addArgument(vars.get(vVarNameKey), vars.get(vVarNameVal));
}



Thank you for help,
Andreas



Deepak Shetty schrieb:
> hi
> you need to add a beanshell preprocessor which loops through the returned
> values and use sampler.addArgument();
> httprequest1
> +RegexExtract
> httprequest1
> +BeanShell Pre Proc
> 
> regards
> deepak
> 
> On Fri, Feb 5, 2010 at 1:17 PM, Andreas Niemeyer <
> andreas.niemeyer@gutzmann.com> wrote:
> 
>> Hi,
>>
>> I want to send a http post sample with dynamic request parameters which
>> comes from a previos request.
>>
>> To extract the values from the form I use a regex extractor and want to
>> loop through the result list of key/value pairs.
>>
>> Is it possible to add these parameters to the request within a foreach
>> loop?
>>
>> The sequence might be:
>>
>> - http request
>>        - extract form values (hidden fields)
>>        - loop in a foreach controller
>>                - add each extracted value pair as request parameter (how?)
>>
>> - send POST request
>>
>>
>> Maybe an alternative way exist? If there is a proposal to use a BeanShell
>> Pre-Prozessor for such a case, could you be so kind and give me an example?
>>
>>
>>
>> Many thanks in advance,
>> Andreas
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message