如何提取服务器返回的该数值,如图
我在进行一个项目的性能测试时,有一个数值是服务器返回来的,但是没办法获取到,如图补充一个:在这个图中,我点击“View->Source”时弹出一个打叉“X”的弹窗(如图),无法看到类似源文件的东东。
[ 本帖最后由 51mobile 于 2008-9-9 15:28 编辑 ] 不太明白,如果是服务器返回的,就肯定能通过 web_reg_save_param 来取出的 部分代码如下:
web_concurrent_end(NULL);
web_submit_data("archiveAction.do_5",
"Action=http://192.168.1.123/archiveAction.do",
"Method=POST",
"Referer=http://192.168.1.123/userAction.do?actionType=150#",
"Snapshot=t219.inf",
"Mode=HTTP",
ITEMDATA,
"Name=actionType", "Value=3", ENDITEM,
"Name=flowId", "Value=7", ENDITEM,
LAST);
web_submit_data("archiveTransAction.do",
"Action=http://192.168.1.123/archiveTransAction.do?actionType=0&id=72",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.1.123/userAction.do?actionType=150#",
"Snapshot=t220.inf",
"Mode=HTTP",
ITEMDATA,
LAST);
红色字体的“72”(也就是第一帖图中的72),是上一个“Submit_data”的Action=http://192.168.1.123/archiveAction.do执行后产生的一个数值,我现在不知道怎么取这个值。
[ 本帖最后由 51mobile 于 2008-9-6 10:58 编辑 ] Generation Log 的日志如下:
****** Request Header For Transaction With Id 318 ******
POST /archiveAction.do HTTP/1.1
Accept: text/javascript, text/html, application/xml, text/xml, */*
Accept-Language: zh-cn
x-prototype-version: 1.6.0.2
Referer: http://192.168.1.123/userAction.do?actionType=150#
x-requested-with: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Host: 192.168.1.123
Content-Length: 21
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: username=te@abc.com; JSESSIONID=arSVigNMg54d4nVA1W
$$$$$$ Request Header For Transaction With Id 318 Ended $$$$$$
****** Request Body For Transaction With Id 318 ******
actionType=3&flowId=7
$$$$$$ Request Body For Transaction With Id 318 Ended $$$$$$
****** Response Header For Transaction With Id 318 ******
HTTP/1.1 200 OK
Server: Resin/3.0.14
Cache-Control: private
Content-Encoding: gzip
Content-Length: 22
Date: Sat, 06 Sep 2008 02:09:02 GMT
$$$$$$ Response Header For Transaction With Id 318 Ended $$$$$$
****** Response Body For Transaction With Id 318 ******
72
$$$$$$ Response Body For Transaction With Id 318 Ended $$$$$$
****** Start Log Message ******
Start Frames Hierarchy Tree Dump
/archiveAction.do?actionType=2&flowId=7
Form: name= action=archiveAction.do
End Frames Hierarchy Tree Dump
$$$$$$ End Log Message $$$$$$
****** Add Event For Transaction With Id 318 ****** (Location Flag : tFlagInsertEnd, Location ID : 318)
web_submit_data("archiveAction.do_5",
"Action=http://192.168.1.123/archiveAction.do",
"Method=POST",
"Referer=http://192.168.1.123/userAction.do?actionType=150#",
"Snapshot=t219.inf",
"Mode=HTTP",
ITEMDATA,
"Name=actionType", "Value=3", ENDITEM,
"Name=flowId", "Value=7", ENDITEM,
LAST);
$$$$$$ Add Event For Transaction With Id 318 Ended $$$$$$
[ 本帖最后由 51mobile 于 2008-9-6 10:59 编辑 ] 用web_reg_save_param()函数去获取,在服务器返回的值里寻找到72,就可以获取了。 用web_reg_save_param()函数去获取,搜索的范围设置为ALL试试 int buffer;
web_reg_save_param("ID", "LB= ", "RB= ", "Ord=All", LAST);
buffer =atoi(lr_eval_string("{ID_1}"));
web_concurrent_end(NULL);
web_submit_data("archiveAction.do_5",
"Action=http://192.168.1.123/archiveAction.do",
"Method=POST",
"Referer=http://192.168.1.123/userAction.do?actionType=150#",
"Snapshot=t219.inf",
"Mode=HTTP",
ITEMDATA,
"Name=actionType", "Value=3", ENDITEM,
"Name=flowId", "Value=7", ENDITEM,
LAST);
lr_message("ID is:%d",buffer);//我在回放日志中查看到打印出来的是0,而不是服务器返回的值“72”,是不是我写的语句有什么错误,大家帮忙看下,谢谢
web_submit_data("archiveTransAction.do",
"Action=http://192.168.1.123/archiveTransAction.do?actionType=0&id=72",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.1.123/userAction.do?actionType=150#",
"Snapshot=t220.inf",
"Mode=HTTP",
ITEMDATA,
LAST);
[ 本帖最后由 51mobile 于 2008-9-9 13:54 编辑 ] buffer =atoi(lr_eval_string("{ID_0}"));
是不是要这样啊 buffer =atoi(lr_eval_string("{ID}")); 谢谢楼上两位,我试过了,都不可以,都是返回0,而不是服务器返回的值 web_reg_save_param("ID", "LB=", "RB=", "Search=Body", LAST);
lr_output_message (lr_eval_string ("{ID}"))
[ 本帖最后由 blinkday 于 2008-9-9 16:06 编辑 ] 复制以下代码到,你的关联函数位置。并删除所有其他手工加的代码。试试:
web_reg_save_param("WCSParam_Text2",
"LB=",
"RB=",
"Ord=1",
"RelFrameId=1",
"Search=Body",
"IgnoreRedirections=Yes",
LAST); 谢谢Zee斑竹,问题解决了
页:
[1]