lr_eval_string("{***_count}")为什么返回的参数个数一直是0?
如题,不知为何能够取到参数化的值并打印出来,但是每次打印返回的参数个数时都是0?部分代码如下,还请高手不吝赐教。web_reg_save_param("model",
"LB=modelno=",
"RB=\"",
"Ord=1",
"RelFrameId=1",
"Search=Body",
"IgnoreRedirections=Yes",
LAST);
lr_message("modelno is: %s", lr_eval_string("{model}"));
count=atoi(lr_eval_string("{model_count}"));
lr_error_message("count is : %d",count);
结果:
modelno is: 3980
Action.c(183): Error: count is : 0
[ 本帖最后由 yglg0003 于 2008-7-30 14:29 编辑 ] lr_eval_string("{model_count}"))中的model_count在哪里呢? lr_eval_string("{model_count}"))不是应该返回,有多少个符合{model}参数化条件的参数吗? 我觉得不是吧,{model_count}这个参数至少得存在吧。 Vugen的函数帮助里面有详细说明:
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}"));
您看看这个是不是这意思?
[ 本帖最后由 yglg0003 于 2008-7-30 15:08 编辑 ] 大虾们来帮忙啊:'(:'(
[ 本帖最后由 yglg0003 于 2008-7-30 15:33 编辑 ] 自己顶上去………… 没有人知道吗?????? 函数帮助里的意思是当ORD=All的时候,才把符合左右边界的值保存在一个数组里.而脚本里,你写的是Ord=1,web_reg_save_paramn()函数只获取第一个匹配条件的值,这也是默认值.并且ORD=1的情况下也没有说把获取的值保存在数组里.如果找到多个匹配条件的值,那应该指定Ord=ALL,如果只找到一个匹配条件的值,那就最好写count=atoi(lr_eval_string("{model}")) web_reg_save_param("model",
"LB=modelno=",
"RB=\"",
"Ord=1",
"RelFrameId=1",
"Search=Body",
"IgnoreRedirections=Yes",
LAST);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-这里都没有请求,那里来的关联结果。。
lr_message("modelno is: %s", lr_eval_string("{model}"));
count=atoi(lr_eval_string("{model_count}"));
lr_error_message("count is : %d",count); 请问ord=1时回放没有错,ord=all时回放就出错了,这是怎么回事呢?
Action.c(162): Error -26612: HTTP Status-Code=500 (Request processing failed; nested exception is java.lang.NullPointerException) for "http://192.168.6.99:8080/ctcmcjz/process.htm?code=1100&modelno={model}"
Action.c(162): web_url("process.htm") highest severity level was "ERROR", 1225 body bytes, 244 header bytes, 12 chunking overhead bytes
页:
[1]