对LR回放中highest severity level was"ERROR"的一个解决方法

LR中录制脚本时有如下问题:

 

在录制时一切正常,而回放时提示类似如下错误:

 

Action.c(41): Error -27979: Requested form not found                                [MsgId: MERR-27979]
             Action.c(41): web_submit_form highest severity level was "ERROR",              0 body bytes, 0 header bytes                       [MsgId: MMSG-27178]"

 

 这时在tree view中看不到此组件的相关URL。
 
处理方法如下:
1, 打开recording options,在internet protocol下的recording中选择recording level为HTML-based script,点击HTML Advanced,选择script type为A script containing explicit.即可。
2, 选择使用URL_based script录制。
另外,附上帮助中的这个错误代码的说明:

Message Code 27979

Requested form not found

The form was not found in the page received from the server. Possible reasons: (i) The current or a previous HTML page was changed after the script was recorded. (ii) A previous request navigated to a wrong page or failed. (iii) One or more web_submit_form arguments are missing or incorrect (especially for manually coded, parameterized, or correlated functions). (iv) The server returned an unexpected page (e.g., under excessive load).

Troubleshooting
      • If the current or previous HTML page was changed, look for the correct properties of the form used in the text (e.g., action), and change it in the script.
      • If your snapshots and extended log are disabled, enable them and run the script again.
        (i) To enable Snapshots: Select Tools > General Options > Correlation, and check the Save correlation information during replay box.
        (ii) To enable Extended Log: Select Run-time Settings > General: Log, and check Enable logging, Always send messages, Extended log, Data returned by server, Advanced trace.
      • Compare the record and replay snapshots for each step in the script from the beginning, and locate the first difference. If you identify a difference in the snapshots, locate the corresponding HTTP request in both the recording log and the extended log. Compare the requests and, if they are different, have the replay issue exactly the same request. This can be done, for example, by adding web_add_header (for adding missing headers or adjusting existing ones), web_remove_auto_header (for removing extra headers), and web_add_cookie (for missing cookies).
      • If some correlation is missing, (e.g., the recording and replay runs have different session IDs), use the correlation tool to locate and handle such cases.
 
虽然给定引用中未直接提及“web_reg_save_param highest severity level was error”错误的解决办法,但可根据LoadRunner中`web_reg_save_param`函数的使用规则来推测可能的解决方向。 ### 1. 确保函数注册位置正确 `web_reg_save_param`必须在获取返回值的操作前面注册,在获取返回值的操作后面使用。若注册位置错误,可能会导致该错误。例如,要保证代码顺序如下: ```c Action() { web_reg_save_param("ParamName", "LB=left boundary", "RB=right boundary", LAST); // 获取返回值的操作,如发送请求 web_url("request_url", ...); // 使用保存的参数 lr_output_message("The saved parameter is %s", lr_eval_string("{ParamName}")); return 0; } ``` ### 2. 检查参数保存范围 保存参数最大不能超过256字节,如果超过256字节需使用`int web_set_max_html_param_len (const char *length )`函数扩大参数保存范围。可通过如下代码扩大范围: ```c Action() { web_set_max_html_param_len("1024"); // 扩大参数最大保存范围为1024字节 web_reg_save_param("ParamName", "LB=left boundary", "RB=right boundary", LAST); // 后续操作 return 0; } ``` ### 3. 确认边界条件大小写匹配 若边界条件需要大小写不敏感匹配,需在`LB`和`RB`后面跟着`/ic`。例如: ```c web_reg_save_param("IsRight", "LB/ic=cache-control: private\r\n\r\n", "RB/ic=|", LAST); ``` ### 4. 检查请求和响应信息 可使用`web_save_header`函数保存请求和响应的头信息,辅助排查问题。示例如下: ```c Action() { web_set_max_html_param_len("262144"); // 默认最大长度为256 web_reg_save_param("ResponseBody", "LB=", "RB=", "Search=Body", LAST); web_save_header(REQUEST, "RequestHeader"); // REQUEST为内置变量,保存请求的头信息,需在发送URL请求前注册使用,将请求头信息存入字符串RequestHeaderweb_save_header(RESPONSE, "ResponseHeader"); // 将RESPONSE保存响应的头信息在字符串ResponseHeader中 // 发送请求 web_url("request_url", ...); return 0; } ```
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值