TA的每日心情 | 奋斗 2015-6-25 18:04 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
根据这个例子强化脚本,应该可以搞定。。。。
原内容地址:http://qiguojieshare.spaces.live.com/
未知用户数量,有70%的人使用百度(http://www.baidu.com),有17%的人使用谷歌(http://www.google.cn),有7%的人使用yahoo(http://search.cn.yahoo.com),剩余的人
使用搜狗(http://www.sogou.com)进行搜索,那么怎么模拟呢?
脚本示例如下:
Action()
{
int which; //存储随机数的变量
which = rand()*100; //生成0-99的随机数并赋值给which
lr_log_message ("DebugInfo:which=%d\n",which);//调试信息
if (which >= 30)//70%访问baidu
{
web_url("www.baidu.com",
"URL=http://www.baidu.com/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
}
else if ((which >=13) and (which <30))//17%访问Google
{
web_url("www.google.cn",
"URL=http://www.google.cn/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
EXTRARES,
"Url=/images/nav_logo3.png", ENDITEM,
LAST);
}
else if ((which >=6) and (which <13)) //7%访问yahoo
{
web_url("search.cn.yahoo.com",
"URL=http://search.cn.yahoo.com/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t3.inf",
"Mode=HTML",
EXTRARES,
"Url=http://search.cn.yimg.com/i/srhp/tbg.gif", ENDITEM,
"Url=http://search.cn.yimg.com/i/srhp/vln.gif", ENDITEM,
LAST);
}
else //6%访问sogou
{
web_url("www.sogou.com",
"URL=http://www.sogou.com/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t4.inf",
"Mode=HTML",
EXTRARES,
"Url=/images/tab.gif", ENDITEM,
"Url=http://pv.sogou.com/pv.gif?t?=1181198683187446?r?=", ENDITEM,
LAST);
}
return 0;
} |
|