/*腳本名稱:web_custom_request_demo腳本功能:通過登錄WebTours的操作來演示web_custom_request函數(shù)的使用使用的技術(shù):關(guān)聯(lián)和檢查點(diǎn)*/Action(){ //定義一個變量,進(jìn)行判斷是否登錄成功時使用 int tag=0; //對userSession進(jìn)行關(guān)聯(lián) // <input type=hidden name=userSession value=110044.482462535fzzAtVDpAzzzzzzHDDQzcptHit> web_reg_save_param("userID","LB=<input type=hidden name=userSession value=","RB=>",LAST); web_url("WebTours", "URL=http://127.0.0.1:1080/WebTours/", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t1.inf", "Mode=HTML", LAST); lr_think_time(9); //檢查點(diǎn)設(shè)置 tag=web_reg_find("Text=jojo","Search=ALL",LAST); /*利用web_custom_request函數(shù)自定義請求*/ web_custom_request("login.pl", "Method=POST", "URL=http://127.0.0.1:1080/WebTours/login.pl", "Body=userSession={userID}&username=jojo&password=bean&JSFormSubmit=off&login.x=54&login.y=8", LAST); if(tag==0) lr_output_message("login successful!"); else lr_output_message("login failed"); /* web_submit_form("login.pl", "Snapshot=t2.inf", ITEMDATA, "Name=username", "Value=jojo", ENDITEM, "Name=password", "Value=bean", ENDITEM, "Name=login.x", "Value=54", ENDITEM, "Name=login.y", "Value=8", ENDITEM, LAST); */ web_image("SignOff Button", "Alt=SignOff Button", "Snapshot=t3.inf", LAST); lr_output_message("signoff successful"); return 0;}