You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Peter Bernier <jm...@binarytwo.com> on 2004/08/24 21:55:22 UTC

Extracting Random Value from a Combobox

Hello,

I've been trying to figure out the correct regular expression to be
using to extract a random value from a combobox (html <select>) and
can't quite seem to get the syntax right.

I'm trying to use this expression in the Regular Expression field of a
Regular Expression Extract Post Processor :

name="cbo_Type" size="1">[\W]*<option value="-1"
SELECTED></option>[\w\W]*<option value="(\d*)"
>[\w\W]*</option>[\W]*</select>

Where cbo_Type is the combobox that I want the values to come from and
all values are positive integer numbers.

Sample code to apply the expression on :
<select id="cbo_Type" name="cbo_Type" size="1">
<option value="-1" SELECTED></option>
<option value="5" >Value 5</option>
<option value="1" >Value 1</option>
<option value="3" >Value 3</option>
<option value="2" >Value 2</option>
<option value="4" >Value 4</option>
</select>

Depending on the expression that I use, I only seem to be able to extract
the first or last integer value (with separate expressions...).

I would greatly appreciate any help with this..

- Peter

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


Re: Extracting Random Value from a Combobox

Posted by Michael Stover <ms...@apache.org>.
I don't think you can do that with regular expressions.  To do so would
require the matcher attempt to match multiple different ways against the
same text, and that's just not how they work.

Alternatively, you can sometimes use the HTML Link Parser for this sort
of thing.  I say 'sometimes' because it's a touchy piece of code that
likes things just so, but if your HTTP Request is otherwise
straightforward, you might be able to do so.  

The basics of using it involve attaching an HTML Link Parser to the
request you want to modify (ie, not the previous request as you would do
with the regular expression post processor).  Then, in your request you
have a parameter named "cbo_Type".  For the value of that parameter, put
'*'.

It might be as easy as that.  Or not :-)

-Mike

On Tue, 2004-08-24 at 15:55, Peter Bernier wrote:
> Hello,
> 
> I've been trying to figure out the correct regular expression to be
> using to extract a random value from a combobox (html <select>) and
> can't quite seem to get the syntax right.
> 
> I'm trying to use this expression in the Regular Expression field of a
> Regular Expression Extract Post Processor :
> 
> name="cbo_Type" size="1">[\W]*<option value="-1"
> SELECTED></option>[\w\W]*<option value="(\d*)"
> >[\w\W]*</option>[\W]*</select>
> 
> Where cbo_Type is the combobox that I want the values to come from and
> all values are positive integer numbers.
> 
> Sample code to apply the expression on :
> <select id="cbo_Type" name="cbo_Type" size="1">
> <option value="-1" SELECTED></option>
> <option value="5" >Value 5</option>
> <option value="1" >Value 1</option>
> <option value="3" >Value 3</option>
> <option value="2" >Value 2</option>
> <option value="4" >Value 4</option>
> </select>
> 
> Depending on the expression that I use, I only seem to be able to extract
> the first or last integer value (with separate expressions...).
> 
> I would greatly appreciate any help with this..
> 
> - Peter
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
-- 
Michael Stover <ms...@apache.org>
Apache Software Foundation


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