Vous êtes sur la page 1sur 5

Action()

{
int a,b,d,i,f,k,w,s,r;
char *temp,*temp1,*temp2,*temp4,*temp5,*temp6,*temp8,*temp9,*temp10;

lr_start_transaction("A1_home");
web_reg_find("Text=Web Tours",
LAST);
//type="hidden" name="userSession" value="116832.905224787zAAQfQcpfzcfDz
AfHpfffDHf"/>
web_reg_save_param("sessionid","LB=type=\"hidden\" name=\"userSession\"
value=\"","RB=\"/",LAST);

web_url("index.htm",
"URL=http://127.0.0.1:1080/WebTours/index.htm",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
lr_end_transaction("A1_home",LR_AUTO);
lr_think_time(3);
lr_start_transaction("A2_login");
web_reg_find("Text=Web Tours",
LAST);

web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/cgi-bin/login.pl",
"Method=POST",
"TargetFrame=body",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value={sessionid}", ENDITEM,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=login.x", "Value=50", ENDITEM,
"Name=login.y", "Value=15", ENDITEM,

LAST);
lr_end_transaction("A2_login",LR_AUTO);
lr_think_time(3);
lr_start_transaction("A3_flights");
web_reg_find("Text=Web Tours",
LAST);
//option selected="selected" value="Denver">Denver</option>
//<option value="Frankfurt">

web_reg_save_param("selected_cities","LB=option selected=\"selected\" va
lue=\"","RB=\">","ord=ALL",LAST);
web_reg_save_param("remaining_cities","LB=option value=\"","RB=\">","ord
=ALL",LAST);
//input type="radio" name="seatPref" value="None" checked="checked"
//capturing seat preference
web_reg_save_param("seat_pref","LB=input type=\"radio\" name=\"seatPref\
" value=\"","RB=\" />","ord=ALL",LAST);
//input type="radio" name="seatType" value="Coach" checked="checked"
//capturing seat type
//input type="hidden" name="seatType" value="Coach"
web_reg_save_param("seat_type","LB=input type=\"radio\" name=\"seatType\
" value=\"","RB=\"","ord=ALL",LAST);

web_url("Search Flights Button",


"URL=http://127.0.0.1:1080/cgi-bin/welcome.pl?page=search",
"TargetFrame=body",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home"
,
"Snapshot=t3.inf",
"Mode=HTML",
LAST);
lr_end_transaction("A3_flights",LR_AUTO);

//merge need to know the length of the each


a=lr_paramarr_len("selected_cities");
b=lr_paramarr_len("remaining_cities");

for(i=1;i<=a;i++)
{
temp=lr_paramarr_idx("selected_cities",i);
d=b+i;
lr_save_int(d,"e");
lr_save_string(temp,lr_eval_string("remaining_cities_{e}"));
}
//for departure
repeat:
temp1=lr_paramarr_random("remaining_cities");
lr_save_string(temp1,lr_eval_string("depcity"));
//for arrival
temp2=lr_paramarr_random("remaining_cities");
lr_save_string(temp2,lr_eval_string("arrivalcity"));
//string comparison
if(strcmp(temp1,temp2)==0)
{
goto repeat;
}
//seat preference selection
f=lr_paramarr_len("seat_pref");
for(k=1;k<=f;k++)
{
temp4=lr_paramarr_idx("seat_pref",k);

temp5=(char*)strtok(temp4,"\"");
lr_save_int(k,"g");
lr_save_string(temp5,lr_eval_string("seat_pref_{g}"));

temp6=lr_paramarr_random("seat_pref");
lr_save_string(temp6,lr_eval_string("seat_pref"));
//for selecting seat_type tokenisation
w=lr_paramarr_len("seat_type");
for(s=1;s<=w;s++)
{
temp8=lr_paramarr_idx("seat_type",s);
temp9=(char *)strtok(temp8,"\"");
lr_save_int(s,"r");
lr_save_string(temp9,lr_eval_string("seat_type_{r}"));
}
temp10=lr_paramarr_random("seat_type");
lr_save_string(temp10,lr_eval_string("seat_type"));

lr_think_time(3);
lr_start_transaction("A4_findflight");
web_reg_find("Text=Flight Selections",
LAST);
web_submit_data("reservations.pl",
"Action=http://127.0.0.1:1080/cgi-bin/reservations.pl",
"Method=POST",
"TargetFrame=",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/reservations.pl?page=welc
ome",
"Snapshot=t4.inf",
"Mode=HTML",
ITEMDATA,
"Name=advanceDiscount", "Value=0", ENDITEM,

"Name=depart", "Value={depcity}", ENDITEM,


"Name=departDate", "Value=09/16/2015", ENDITEM,
"Name=arrive", "Value={arrivalcity}", ENDITEM,
"Name=returnDate", "Value=09/17/2015", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=seatPref", "Value={seat_pref}", ENDITEM,
"Name=seatType", "Value={seat_type}", ENDITEM,
"Name=.cgifields", "Value=roundtrip", ENDITEM,
"Name=.cgifields", "Value=seatType", ENDITEM,
"Name=.cgifields", "Value=seatPref", ENDITEM,
"Name=findFlights.x", "Value=71", ENDITEM,
"Name=findFlights.y", "Value=11", ENDITEM,
LAST);
lr_end_transaction("A4_findflight",LR_AUTO);
lr_think_time(3);
lr_start_transaction("A5_signoff");
web_reg_find("Text=Web Tours",
LAST);
web_url("SignOff Button",
"URL=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=1",
"TargetFrame=body",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=fligh
ts",
"Snapshot=t5.inf",
"Mode=HTML",
LAST);
lr_end_transaction("A5_signoff",LR_AUTO);
lr_think_time(3);
return 0;
}

Vous aimerez peut-être aussi