1、獲得網(wǎng)站首頁
web_url("www.seventest.net",
"URL=www.seventest.net/",
"TargetFrame=", //目標窗口_BLANK:打開一個新窗口
_PARENT:取代最后一個窗口的父窗口
_SELF:取代最后一個窗口
_TOP:取代整個頁面
"Resource=0", //URL是否為一個資源 0:不是
1:是
"RecContentType=text/html", //錄制過程中,響應報頭內(nèi)容格式
"Referer=", //提交網(wǎng)頁的URL
"Snapshot=t1.inf", //快照文件名
"Mode=HTML", //錄制水平: HTML or HTTP.
HTML level:指導VuGen錄制直觀的HTML動作,錄制web_url,web_link,web_image。返回的是HTML頁面,而不是腳本和程序。
HTTP level:指導VuGen錄制全部的服務器響應。不產(chǎn)生web_link,web_image,web_submit_form。比HTML高級,但當讀腳本時不是很直觀。
EXTRARES, //參數(shù)表劃分標志(下個標志是一個資源特征表)
"Url=/dy.css", "Referer=http://www.seventest.net/index.htm", ENDITEM, //資源結(jié)束志
"Url=/images/bg_03.gif", "Referer=http://www.seventest.net/index.htm", ENDITEM,
"Url=/images/logo-end%2020GAI.swf","Referer=http://www.seventest.net/index.htm", ENDITEM,
"Url=/images/2.swf", "Referer=http://www.seventest.net/index.htm", ENDITEM,
LAST); //特征表結(jié)束標志
2、下載一個游戲
web_url("Games",
"URL=ftp://joe:secret@mygames.com/games/archive/loderunner.exe",
"FtpAscii=1", //1:用ASCII模式執(zhí)行FTP傳輸
//0:二進制模式
LAST);
3、百度搜索“科學”
Action()
{
//打開首頁
web_add_cookie ("BAIDUID=AAFDECDD16EF55636CA63DC64381BBEC:FG=1; DOMAIN=www.baidu.com");
web_add_cookie("BDSTAT=7e00ef72b41d6156ecc
//網(wǎng)絡接口的對象表達式,經(jīng)常用在Java和VB.
//name=VALUE;必須
//domain=DOMAIN_NAME;必須
//expires=DATE;
//path=PATH; (default path is "/")
//secure
//The elements in the Cookie parameter are the same as the elements in the
//Set–Cookie HTTP Response Header.
web_url("www.baidu.com",
"URL=http://www.baidu.com/",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/favicon.ico", "Referer=", ENDITEM,
LAST);
web_add_cookie("BAIDUID=AAFDECDD16EF55636CA63DC64381BBEC:FG=1; DOMAIN=s.baidu.com");
web_add_cookie("BDSTAT=7e00ef72b41d6156ecc
DOMAIN=s.baidu.com");
lr_think_time(13);
//搜索“科學”
web_submit_data("s", //提交數(shù)據(jù)
"Action=http://www.baidu.com/s", //提交數(shù)據(jù)的HTTP address
"Method=GET",
"EncType=", //編碼方式
"TargetFrame=",
"RecContentType=text/html",
"Referer=http://www.baidu.com/",
"Snapshot=t2.inf",
"Mode=HTML", //錄制水平
ITEMDATA,
"Name=wd", "Value=?", ENDITEM,
"Name=cl", "Value=3", ENDITEM,
EXTRARES,
"Url=http://s.baidu.com/w.gif?path=http://www.baidu.com/s?wd=%BF%C6%D1%A7&cl=3&t=1200288916042",
"Referer=http://www.baidu.com/s?wd=%BF%C6%D1%A7&cl=3", ENDITEM,
LAST);
return 0;
}