Web Vuser Functions (WEB) > Alphabetical List of Web Vuser Functions > web_reg_save_param

web_reg_save_param

Registers a request to save dynamic data information to a parameter.

The C language version of this function is deprecated: In C, use web_reg_save_param_ex or web_reg_save_param_xpath.

Java Language

int object.reg_save_param( String ParamName, String[] attributeList);
Example: web.reg_save_param Correlation Functions Java Syntax
Argument Description
object An expression evaluating to an object of type WebApi. Usually web for Java. See also Function and Constant Prefixes.
ParamName A null–terminated string indicating the name of the parameter to create.
List of Attributes For details of each attribute, see List of Attributes. Attribute value strings are not case–sensitive. For example, "Search=all" is the same as "Search=All.
LAST A marker that indicates the end of the argument list.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

Parameterization

The following argument(s) can be parameterized using standard parameterization: ParamName, List of Attributes

General Information

web_reg_save_param registers a request to find and save a text string within the server response to the next action function. The search does not to apply values returned as a result of calls to asynchronous or cross-step functions.

web_reg_save_param is only recorded when correlation during recording is enabled (see VuGen's Recording Options). VuGen must be in either URL–based recording mode, or in HTML–based recording mode with the A script containing explicit URLs only option checked (see VuGen's Recording Options).

This function registers a request to retrieve dynamic information from the downloaded page, and save it to a parameter. For correlation, enclose the parameter in braces (e.g., "{param1}") in ensuing function calls which use the dynamic data. See also Correlating Statements.

The request registered by web_reg_save_param looks for the characters between (but not including) the specified boundaries and saves the information that begins at the byte after the left boundary and ends at the byte before the right boundary.

If you expect leading and trailing spaces around the string and you do not want them in the parameter, add a space at the end of the left boundary, and at the beginning of the right boundary. For example, if the Web page contains the string, "Where and when do you want to travel?", the call:

web_reg_save_param("When_Txt", "LB=Where and ", "RB= do", LAST );

with a space after "and" and before "do", will result in "when" as the value of When_Txt. However,

web_reg_save_param("When_Txt", "LB=Where and", "RB=do", LAST );

without the spaces, will result in a value of " when ".

Embedded boundary characters are not supported. web_reg_save_param results in a simple search for the next occurrence after the most recent left boundary. For example, if you have defined the left boundary as the character `{` and the right boundary as the character `}', then with the following buffer c issaved:

          {a{b{c}

The left and right boundaries have been located. Since embedded boundaries are not supported, the `}' is matched to the most recent `{` appearing just before the c. The ORD attribute is 1. There is only one matching instance.

The web_reg_save_param function also supports array type parameters. When you specify ORD=All, all the occurrences of the match are saved in an array. Each element of the array is represented by the ParamName_index. In the following example, the parameter name is A:

web_reg_save_param("A", "LB/ic=<a href=", "RB=\'>", "Ord=All", LAST );

The first match is saved as A_1, the second match is saved as A_2, and so forth. You can retrieve the total number of matches by using the following term: ParamName_count. For example, to retrieve the total number of matches saved to the parameter array, use:

TotalNumberOfMatches=atoi(lr_eval_string("{A_count}"));

The following table indicates how to use the boundary parameters to save portions of the parameter string:

Portion of string to save to parameter LB RB
the entire string empty empty
a string delimited by boundaries boundary boundary
the beginning of a string until the first right boundary empty boundary
the last left boundary until the end boundary empty

This function is supported for all Web scripts.

List of Attributes