需求--进入一个页面后,页面列出了所有list的 内容。需要模拟将所有条目都点击一次。
必须知道这个模块下的所有条目是多少。数组的大小为执行循环次数。并且将取出的值作为URL中的参数。
运行通过的代码
Action()
{
char
buffer[128] = {0};
int
j;
int
i;
//取出所有的符合条件的值,保存在array
web_reg_save_param("param1",
"LB=Bug.php?BugID=",
"RB=\" title=",
"Notfound=error",
"ord=all",
LAST);
web_url("BugList.php_3",
"URL=http://192.168.1.116/bugfree/BugList.php?",
"TargetFrame=RightBottomFrame",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.1.116/bugfree/BugList.php?ProjectID=1",
"Snapshot=t11.inf",
"Mode=HTML",
LAST);
//取出web_reg_save_param保存在array的数量
j=atoi(lr_eval_string("{param1_count}"));
lr_output_message("the
j is %d",j);
for(i=1;i<=j;i++)
{
//赋值给变量buffer
sprintf(buffer, "{param1_%d}", i);
lr_output_message("the conut is
%s.",lr_eval_string(buffer));
//变量转换成参数
lr_save_string(lr_eval_string(buffer),"bufferstring");
web_url("Bug.php",
//使用参数
"URL=http://192.168.1.116/bugfree/Bug.php?BugID={bufferstring}",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.1.116/bugfree/BugList.php?ProjectID=1",
"Mode=HTML",
LAST);
}
return 0;
}