Action()
{
int pageSum; //存总共的页数
char randpage[4];//存随机后的页数
//访问首页的事务
lr_start_transaction("homePage");
web_url("e6mall",
"URL=http://192.168.1.101:40001/e6mall/",
LAST);
lr_end_transaction("homePage",LR_AUTO);
//取得总共的页数
web_reg_save_param("page",
"LB=href="?c=browse&keyword=&cg=&marker=B&page=",
"RB=">鏈€鍚庨〉</a></span> ",
LAST);
web_url("e6mall",
"URL=http://192.168.1.101:40001/e6mall/?c=browse",
LAST);
//取到总分页数,在此范围内随机取值
pageSum=atoi(lr_eval_string("{page}"));
//lr_output_message("%d",pageSum);
//lr_output_message("randpage %d",rand()%pageSum+1);
itoa(rand()%pageSum+1,randpage,10);
lr_save_string(randpage,"rpage");
lr_start_transaction("page");
web_url("e6mall",
"URL=http://192.168.1.101:40001/e6mall/?c=browse&keyword=&cg=&marker=B&page={rpage}",
LAST);
lr_end_transaction("page",LR_AUTO);
return 0;
}