12-18-2013 10:18 AM - edited 12-18-2013 10:22 AM
I need to take count 3 below for warnings
how to get using web_reg_save_param
output needed here = warning count is 3
<div class="staRow"> <div class="staBar" title="Warning (3)"> <div id="serStatusWarning" style="width:9%"> </div> </div> <div class="statusLabel"> <a href="URL" title="View list of servers with health of WARNING (3)"> Warning (3)</a> </div> </div>
else I have Warning images 3 on page, how to count images from loadrunner, can I do that ?
Smile tomorrow will be worse !!!
Solved! Go to Solution.
12-18-2013 12:39 PM - edited 12-18-2013 11:25 PM
With web_reg_save_param you can retrieve a character or multiple characters from a stream of data.
You retrieve the string which is delimited by 2 boundaries.
A left boundary and a right boundary.
The characters between the boundaries are stored in a parameter.
If you would like to retrieve the text 'serStatusWarning', from your data, then you need a left boundary and a right boundary.
Left boundary like '<div id=\"' (Without the single qoutes, you need the extra backslash, in front of the doublequote, to let the Loadrunner compiler know, to interpret the next character as part of the boundary)
Right boundary like '\" style=\"' (Again without the single qoutes, again you need the extra backslashes)
Now Loadrunner knows to scan for the left boundary and save all the characters in a string untill Loadrunner retrieves the right boundary. The string is saved afterwords in a parameter.
The statement looks like this:
web_reg_save_param("Param_Name", "LB=<div id=\"", "RB=\" style=\"", LAST);
Now to your case.
You would like to retrieve the text 'warning count is 3'.
But this text is not in your data.
So it can not be retrieved.
Probably you would like to retrieve only the 3.
There are multiple characters '3'.
Lets try to retrieve the first one.
Try this in your script:
web_reg_save_param("Param_Name", "LB=title=\"Warning (", "RB=)\">", LAST);
Also it is possible to retrieve multiple items.
Read the Function Reference there are a few examples.
Keep in mind that only a certain amount of characters can be retrieved.
You can control this with web_set_max_html_param_length.