Quantcast
Channel: LoadRunner Practitioners Forum topics
Viewing all articles
Browse latest Browse all 3978

Using regex in web_reg_save_param boundaries

$
0
0

Hi all,

 

I am trying to write a script which will pick up a dynamic value from a drop down menu and submit it to go to the next page. The HTTP response looks like this:

 

\t\t\t\t\t<option value="Rose taupe" id="WD26"class="WD26">Rose taupe</option>\n

\t\t\t\t\t<option value="Myrtle" id="WD20"class="WD20">Myrtle</option>\n

\t\t\t\t\t<option value="Deep carmine pink" id="WD142"class="WD142">Deep carmine pink</option>\n \t\t\t\t\t<option value="Wild Strawberry" id="WD66"class="WD66">WildStrawberry</option>\n

\t\t\t\t\t<option value="Cream" id="WD72" selected="selected"class="WD72">Cream</option>\n

\t\t\t\t\t<option value="Tangerine yellow" id="WD94"class="WD94">Tangerine yellow</option>\n

 

I want to pick up the color that is selected in a drop down menu in the front end, in the response this color line has selected="selected" in it. This is however random for each instance hence the regex has to pickup the color name from the line which contains selected="selected".

 

I tried using web_reg_save_param_regexp with the regular expression <option value="([^"]*)" id="[^"]*" selected="selected but there are two dynamic values i.e. value and id.

 

I want to use a simple web_reg_save_param where I can use regex in the boundaries so as to pick up the color name from the response. So far what I have is:

 

    web_reg_save_param_ex("ParamName=SelectedColor", 
    "LB/IC=\t\t\t\t\t<option value=\"",
    "RB/ALNUMIC=\" id=\"[^\"]*\" selected=\"selected\"",
    "Ord=all",
    "Search=body",
    LAST);

 

OR


    web_reg_save_param_ex("ParamName=SelectedColor", 
    "LB/ALNUMIC=selected=\"selected\" class=\"[^\"]*\">",
    "RB/IC=</option>\n",
    "Ord=all",
    "Search=body",
    LAST);

 

However this gives me an error Action1.c(73): Error -26396: The "RB/ALNUMIC=" id="[^"]*" selected="selected"" argument (number 3) is unrecognized or misplaced   [MsgId: MERR-26396].

 

Can anyone please help me in using regex in the boundaries for this function? Thanks a lot, and kindly let me know if more details are needed!


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>