搞了大半天,终于能正常通过web_reg_save_param获取到自己想要的返回值了。
网上说了好多办法,但是对我都没用,我的办法是先用web_reg_save_param函数获取所有响应body体内容,然后根据返回的结果设置LB、RB值。
获取整个响应body体方法。
web_reg_save_param("ResponseBody",
"LB=",
"RB=",
"Search=Body",LAST);//获取所有的responsebody值。
如果使用LR11,使用web_reg_save_param_ex函数更好些。
web_reg_save_param_ex(
“ParamName=temp”,
"LB=",
"RB=",
"Ordinal=1",
SEARCH_FILTERS,
"ContentType=text/html",
LAST);
示例:比如说从WEB页面上看返回值为userid:10,username:十,那么如果想获取到userid的值:10方法如下:
方法一:通过返回页面上格式设置LB和RB,这样做一直是报错,后来就尝试了方法二。
web_reg_save_param_ex(
“ParamName=userid”,
"LB=userid:",
"RB=,username",
"Ordinal=1",
SEARCH_FILTERS,
"ContentType=text/html",
LAST);
方法二:通过在日志中查看整个响应BODY体,来设置LB、RB。
web_reg_save_param_ex(
“ParamName=userid”,
"LB=\nuserid:",
"RB=,\nusername",
"Ordinal=1",
SEARCH_FILTERS,
"ContentType=text/html",
LAST);
上述两种方法可以看出,方法二变量前边都多个换行符\n,我也不知道为什么这样就没问题,但是查看body体中变量前确实都加了\n,这样设置就不报错了。
其它人的解决方法通常如下,供大家参考。
Error -26377
web_set_max_html_param_len("1024");
Action.c(56): Error -26377: No match found for the requested parameter "returncodeVar". Check whether the requested boundaries exist in the response data.
Also, if the data you want to save exceeds 4096 bytes, use web_set_max_html_param_len to increase the parameter size
经测试发现...
web_set_max_html_param_len("1024");语句应该写在web_reg_save_param()之前,例如:
web_set_max_html_param_len("1024");
web_reg_save_param("returncodeVar",
"LB={\"returncode\":\"",
"RB=\"}",
"Ord=1",
LAST);
如果脚本中多次用到web_reg_save_param()应该每处都加上这句web_set_max_html_param_len()
办法一不能解决的情况下,
解决办法如下:设置runt time setting中的internet protocol-preferences中的advaced区域有一个winlnet replay instead of sockets选项,选项后再回放就成功了!
Error -27740
Action.c(5): Error -27740: Overlapped transmission of request to "192.168.4.177" for URL "http://192.168.4.177:8080/" failed: WSA_IO_PENDING
http://blog.csdn.net/zeeslo/article/details/1938160
Troubleshooting
Add the following statement to the beginning of the script to disable the breakdown of the "First Buffer" into server and network time: web_set_sockets_option("OVERLAPPED_SEND", "0");
Error -27727
Action.c(5): Error -27727: Step download timeout (180 seconds) has expired when downloading resource(s). Set the "Step Timeout caused by resources is a warning" Run-Time Setting to Yes/No to have this message as a warning/error, respectively
一、Step download timeout (120 seconds)
这是一个经常会遇到的问题,解决得办法走以下步骤:
1、修改run time setting中的请求超时时间,增加到600s,其中有三项的参数可以一次都修改了,HTTP-request connect timeout,HTTP-request receieve timeout,Step download timeout,分别建议修改为600、600、5000。run time setting设置完了后记住还需要在control组件的option的run time setting中设置相应的参数。
2、办法一不能解决的情况下,解决办法如下:
设置 runt time setting 中的 internet protocol-preferences 中的 advaced 区域有一个 winlnet replay instead of sockets 选项,选项后再回放就成功了。切记此法只对 windows 系统起作用,此法来自 zee 的资料。Error -27796
Action.c(5): Error -27796: Failed to connect to server "192.168.4.177:8080": [10060] Connection timed out
Error -27791
Action.c(5): Error -27791: Server "192.168.4.177" has shut down the connection prematurely
Error -27728
Action.c(5): Error -27728: Step download timeout (180 seconds) has expired
Abnormal termination, caused by mdrv process termination.
Error -27496: Internal Error - InternetCloseHandle failed for item at 0C678FF8, Windows error code=6. Assuming the item can be deleted, but error(s) may occur in fvLrwNetWinInetCallback
Action.c(23): Error -27492: "HttpSendRequest" failed, Windows error code=12002 and retry limit (0) exceeded for URL="http://www.xxxx.com/"
Error -26499: Internal Error - Granulated Transaction_UserDataPoint("HTTP_200", 1) failed, rc=-1
Action.c(23): Error -26377: No match found for the requested parameter "hotelId". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 1024 bytes, use web_set_max_html_param_len to increase the parameter size
Action.c(23): Error -26374: The above "not found" error(s) may be explained by header and body byte counts being 0 and 0, respectively.
Action.c(64): Error: C interpreter run time error: Action.c (64): Error -- memory violation : Exception ACCESS_VIOLATION received.
LR中在winsocket下解决10053错误
http://haotesting.blogbus.com/logs/33921729.html
http://bbs.51testing.com/thread-478927-1-1.html?/index
http://www.51testing.com/?60038/action_viewspace_itemid_3786.html
http://blog.csdn.net/qinyq88826/article/details/8955963