Question

I have recorded session with recording controller in JMeter.

I was filling lot of forms in this session. There was also selectboxes with values depends values in other forms.

for example:

for value: "john" in textbox, in my selectbox appears values "1" and "2" 
(one these i need to choose - noone is choosen by default)

for value: "jack" in textbox, in my selectbox appears values "3" and "4" 
(the same as above)

How to set in Jmeter to select first from available values in this selectbox?

Was it helpful?

Solution

There is smth like Xpath extractor in Jmeter. Add it to a HTTP Request before this page where u have selectbox (becouse page before got response with this selectbox)

Assuming your selectbox is have id = "selectboxid" u can use smth like this:

//select[@id="selectboxid"]/option[1]/@value

Take a look on some Xpath tutorials to learn more

OTHER TIPS

Assuming you are selecting these values with a POST request you can use the parameters to do something like this -

NAME VALUE
HasAccount false
Settings.ageGroup ${__Random(1,4)}

This is on a newsletter sign up page I was testing. The parameters that are set to false (or true) are for checkboxes and radio buttons. The other one is a dropdown where I wanted to select a random value.

In your case, I imagine this could result in some invalid values. I think the best option is a small Beanshell (or similar) sampler that evaluates whether Jack or John has been selected. This is will obviously scale very badly if you have lots of users though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top