web_reg_save_param

  HP LoadRunner Online Function Reference > Web Vuser Functions (WEB) > web_reg_save_param 

web_reg_save_param  

 Return Values  Parameterization   返回值参数化

Deprecated 弃用: Use web_reg_save_param_ex or web_reg_save_param_xpath.   

Registers a request to save dynamic data information to a parameter.   注册一个将动态数据信息保存到一个参数的请求

C Language 
int web_reg_save_param( const char *ParamName, <List of Attributes>, LAST );  

Exampe    See Also 
Java Language 
int object.reg_save_param( String ParamName, String[] attributeList );   
Example    See Also    Java syntax 
 Argument  Description   参数描述
 一种对WebApi类型的对象进行评估的表达式。通常是web用于Java和Visual Basic。也可以看到函数和常量前缀。
object  An expression evaluating to an object of type WebApi. Usually web for Java and Visual Basic. 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 (e.g., "Search=all") are not case–sensitive.   (如属性值字符串。“搜索=all”)并不是区分大小写的。  
LAST  A marker that indicates the end of the argument list.   最后一个表示参数列表结束的标记。

The web_reg_save_param function is a Service function used for correlating HTML statements in Web scripts.  webregsaveparam函数是一个用于在Web脚本中关联HTML语句的服务函数。

Click here for an overview on Correlation. 点击此处查看有关相关性的概述。

General Information  一般信息

webregsaveparam是一个注册类型函数。它注册一个请求,以便在服务器响应中找到并保存一个文本字符串。该操作仅在执行下一个操作函数之后执行,例如weburl。
web_reg_save_param is a registration type function. It registers a request to find and save a text string within the server response.
 The operation is performed only after executing the next action function, such as web_url. 

 webregsaveparam只记录在录制期间的相关性(请参阅VuGen的记录选项)。VuGen必须在基于url的记录模式,或者在基于html的记录模式下,使用一个包含显式url唯一选项的脚本(参见VuGen的记录选项)。
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). 

该函数注册一个请求,从下载的页面中检索动态信息,并将其保存到一个参数中。为了关联,将参数括在括号内(例如:在随后的函数调用中,使用动态数据。
webregsaveparam注册的请求将查找(但不包括)指定边界的字符,并保存从左边界开始的字节开始的信息,并在右边界之前的字节结束。
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.
 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. 

 如果你希望在字符串周围有引导和拖放的空间(空格),你不希望它们在参数中,在左边界的末端加上一个空格,在右边界的开始。例如,如果Web页面包含字符串,“您想在哪里和什么时候旅行?”,电话:
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 ". 

不支持嵌入的边界字符。webregsaveparam将在最近的左边界之后进行简单的搜索,以查找下一个发生的事件。例如,如果您将左边界定义为字符{和正确的边界作为字符如},那么使用以下缓冲c将被保存:
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 is saved: {a{b{c} 


左和右边界已经被定位。由于不支持嵌入的边界,所以}与最近出现在c之前的{最近的情况相匹配”,而“ORD”属性是1。只有一个匹配的实例。
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. 


webregsaveparam函数还支持数组类型参数。当您指定了All时,匹配的所有事件都保存在一个数组中。数组的每个元素都由parnameindex表示。在下面的例子中,参数名是:A
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 );

第一个参数匹配被保存为A_1,第二个参数匹配被保存为A_2,等等。您可以使用parnamecount来检索匹配的总数。例如,要检索保存到参数数组的所有匹配的总数,请使用:TotalNumberOfMatches=atoi(lrevalstring(“acount”));
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  
Portion of string to save to parametert he entire string (整个字符串)emptyempty 
a string delimited by boundaries (由边界分隔的字符串)boundaryboundary 
the beginning of a string until the first right boundary  (字符串开始到第一个右边界)emptyboundary 
the last left boundary until the end (最后一个左边界到最后boundaryempty 

该函数支持所有Web脚本,以及在HTTP或无线会话协议(WSP)重放模式下运行的WAP脚本。
This function is supported for all Web scripts, and for WAP scripts running in HTTP or Wireless Session Protocol (WSP) replay mode. 


List of Attributes 属性列表
Convert: The possible values are:
HTML_TO_URL: convert HTML–encoded data to a URL–encoded data format  将html编码的数据转换为url编码的数据格式
HTML_TO_TEXT: convert HTML–encoded data to plain text format 将html编码的数据转换为纯文本格式
This attribute is optional.这个属性是可选的。

IgnoreRedirections:如果指定了“IgnoreRedirections = Yes”,并且服务器响应是重定向信息(HTTP状态代码300-303,307),不搜索响应。 相反,在接收到重定向响应后,GET请求被发送到重定向的位置,并且对该位置的响应执行搜索。
IgnoreRedirections: If "IgnoreRedirections=Yes" is specified and the server response is redirection information (HTTP status code 300-303, 307),
the response is not searched. Instead, after receiving a redirection response, the GET request is sent to the redirected location and the search is performed on the response from that location. 
This attribute is optional. The default is "IgnoreRedirections=No".   这个属性是可选的,默认值为no

参数的左边界或动态数据。 如果不指定LB值,则使用从数据开头的所有字符作为边界。边界参数区分大小写,不支持正则表达式。 要进一步自定义搜索文本,请使用一个或多个文本标记。 此属性是必需的。 请参阅边界参数部分。
LB: The left boundary of the parameter or the dynamic data. If you do not specify an LB value, it uses all of the characters from the beginning of the data as a boundary. 
Boundary parameters are case–sensitive and do not support regular expressions. To further customize the search text, use one or more text flags. This attribute is required. See the Boundary Arguments section.

未找到边界并生成空字符串时的处理选项。
NOTFOUND: The handling option when a boundary is not found and an empty string is generated. 
"Notfound=error", the default value, causes an error to be raised when a boundary is not found.  默认值: 当边界没有找到则会导致出现一个错误
早期版本中Notfound=empty, 不会产生一个错误,如果边界没有找到,设置参数的count=0,并继续执行脚本,当你知道字符串是否找到,但是你不想脚本执行失败,warning是一个理想选择
"Notfound=warning" ("Notfound=empty" in earlier versions), does not issue an error. If the boundary is not found, it sets the parameter count to 0, and continues executing the script. 
The "warning" option is ideal if you want to see if the string was found, but you do not want the script to fail.
注意:如果脚本中Continue on Error设置有效,即便NOTFOUND设置为“error”, 当边界没有找到,脚本也继续执行,但是会在Externd log file 中写入一个Error Message。 
Note: If Continue on Error is enabled for the script, then even when NOTFOUND is set to "error", the script continues when the boundary is not found, but an error message is written to the Extended log file. 
This attribute is optional. 这个属性是可选的。

表示匹配的顺序位置或实例。默认实例为1,当你选ALL, 将参数值保存在一个数数组中,该属性是可选的
ORD: Indicates the ordinal position or instance of the match. The default instance is 1. If you specify "All," it saves the parameter values in an array. This attribute is optional.

使用实例而不是向后兼容是支持向后兼容性的,但不赞成。????
Note: The use of Instance instead of ORD is supported for backward compatibility, but deprecated.


参数的右边界或动态数据。 如果不指定RB值,它使用所有字符直到数据的结束作为边界。边界参数区分大小写,不支持正则表达式。 要进一步自定义搜索文本,请使用一个或多个文本标记。 此属性是必需的。 请参阅边界参数部分。
RB: The right boundary of the parameter or the dynamic data. If you do not specify an RB value, it uses all of the characters until the end of the data as a boundary. 
Boundary parameters are case–sensitive and do not support regular expressions. To further customize the search text, use one or more text flags. This attribute is required. See the Boundary Arguments section.


 与请求的URL相关的HTML页面的层次结构级别。可能的值是全部或一个数字。单击RelFrameID属性以获得详细描述。这个属性是可选的。

RelFrameID: The hierarchy level of the HTML page relative to the requested URL. The possible values are ALL or a number. Click RelFrameID Attribute for a detailed description. This attribute is optional.
Note: RelFrameID is not supported in GUI level scripts. 

从指定的偏移量到保存到参数的一个子串的子串的长度。这个属性是可选的。默认值为-1,表示将保存到字符串的末尾
SaveLen: The length of a sub–string of the found value, from the specified offset, to save to the parameter. This attribute is optional. The default is –1, indicating to save to the end of the string.

被找到值的子串的偏移量,以保存到参数。偏移量必须是非负的。缺省值是0。这个属性是可选的
SaveOffset: The offset of a sub–string of the found value, to save to the parameter. The offset value must be non–negative. The default is 0. This attribute is optional.

搜索分隔的数据的搜索范围。可能的值是头(只搜索header)、Body(只搜索Body数据,而不是header),Noresource(只搜索HTML主体,不包括所有的头和资源),或者全部(搜索主体、头和资源)。默认值是全部。这个属性是可选的。
Search: The scope of the search—where to search for the delimited data. The possible values are Headers (Search only the headers), Body (search only body data, not headers),
Noresource (search only the HTML body, excluding all headers and resources), or ALL (search body , headers, and resources). The default value is ALL. This attribute is optional.
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值