Search code examples
javajmeterweb-testing

Default variables and select lists in JMeter


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?


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