- Action()
- {
- // 设置响应信息最大长度
- web_set_max_html_param_len("1024");
-
- /* Registering parameter(s) from source task id 13
- // {WCSParam3} = "126280.293479141ztQfftcpfQfiDDDDDiQHDpcfffHf"
- // */
-
- // 产生关联, 获取session
- web_reg_save_param("session",
- "LB/IC=name=userSession value=",
- "RB/IC=>",
- "Ord=1",
- "Search=Body",
- "RelFrameId=1.2.1",
- LAST);
-
- // 插入订票集合点
- lr_rendezvous("订票");
-
-
-
- // 打开登录页面
- web_url("打开登录页面",
- "URL=http://127.0.0.1:1080/WebTours/",
- "TargetFrame=",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=",
- "Snapshot=t1.inf",
- "Mode=HTML",
- LAST);
-
- // 登录
- // 插入开始的事务
-
- lr_start_transaction("login");
-
- web_submit_data("登录",
- "Action=http://127.0.0.1:1080/WebTours/login.pl",
- "Method=POST",
- "TargetFrame=",
- "RecContentType=text/html",
- "Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
- "Snapshot=t2.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=userSession", "Value={session}", ENDITEM,
- "Name=username", "Value={user_name}", ENDITEM,
- "Name=password", "Value={password}", ENDITEM,
- "Name=JSFormSubmit", "Value=on", ENDITEM,
- "Name=login.x", "Value=48", ENDITEM,
- "Name=login.y", "Value=9", ENDITEM,
- LAST);
- // 插入结束事务
- lr_end_transaction("login", LR_AUTO);
-
-
- lr_think_time(17);
- // 搜索航班信息
- // 插入订票开始的事务
-
- lr_start_transaction("订票");
-
- web_url("搜素航班信息",
- "URL=http://127.0.0.1:1080/WebTours/welcome.pl?page=search",
- "TargetFrame=body",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
- "Snapshot=t3.inf",
- "Mode=HTML",
- LAST);
-
- // 选择座位
- web_submit_data("选择座位",
- "Action=http://127.0.0.1:1080/WebTours/reservations.pl",
- "Method=POST",
- "TargetFrame=",
- "RecContentType=text/html",
- "Referer=http://127.0.0.1:1080/WebTours/reservations.pl?page=welcome",
- "Snapshot=t4.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=advanceDiscount", "Value=0", ENDITEM,
- "Name=depart", "Value=Denver", ENDITEM,
- "Name=departDate", "Value=05/28/2019", ENDITEM,
- "Name=arrive", "Value=Denver", ENDITEM,
- "Name=returnDate", "Value=05/29/2019", ENDITEM,
- "Name=numPassengers", "Value=1", ENDITEM,
- "Name=seatPref", "Value=Window", ENDITEM,
- "Name=seatType", "Value=Business", ENDITEM,
- "Name=.cgifields", "Value=roundtrip", ENDITEM,
- "Name=.cgifields", "Value=seatType", ENDITEM,
- "Name=.cgifields", "Value=seatPref", ENDITEM,
- "Name=findFlights.x", "Value=72", ENDITEM,
- "Name=findFlights.y", "Value=11", ENDITEM,
- LAST);
-
- // 选择航班
- web_submit_data("选择航班",
- "Action=http://127.0.0.1:1080/WebTours/reservations.pl",
- "Method=POST",
- "TargetFrame=",
- "RecContentType=text/html",
- "Referer=http://127.0.0.1:1080/WebTours/reservations.pl",
- "Snapshot=t5.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=outboundFlight", "Value=000;0;05/28/2019", ENDITEM,
- "Name=numPassengers", "Value=1", ENDITEM,
- "Name=advanceDiscount", "Value=0", ENDITEM,
- "Name=seatType", "Value=Business", ENDITEM,
- "Name=seatPref", "Value=Window", ENDITEM,
- "Name=reserveFlights.x", "Value=57", ENDITEM,
- "Name=reserveFlights.y", "Value=12", ENDITEM,
- LAST);
-
- // 支付
- web_submit_data("支付",
- "Action=http://127.0.0.1:1080/WebTours/reservations.pl",
- "Method=POST",
- "TargetFrame=",
- "RecContentType=text/html",
- "Referer=http://127.0.0.1:1080/WebTours/reservations.pl",
- "Snapshot=t6.inf",
- "Mode=HTML",
- ITEMDATA,
- "Name=firstName", "Value=Joseph", ENDITEM,
- "Name=lastName", "Value=Marshall", ENDITEM,
- "Name=address1", "Value=234 Willow Drive", ENDITEM,
- "Name=address2", "Value=San Jose/CA/94085", ENDITEM,
- "Name=pass1", "Value=Joseph Marshall", ENDITEM,
- "Name=creditCard", "Value=", ENDITEM,
- "Name=expDate", "Value=", ENDITEM,
- "Name=oldCCOption", "Value=", ENDITEM,
- "Name=numPassengers", "Value=1", ENDITEM,
- "Name=seatType", "Value=Business", ENDITEM,
- "Name=seatPref", "Value=Window", ENDITEM,
- "Name=outboundFlight", "Value=000;0;05/28/2019", ENDITEM,
- "Name=advanceDiscount", "Value=0", ENDITEM,
- "Name=returnFlight", "Value=", ENDITEM,
- "Name=JSFormSubmit", "Value=off", ENDITEM,
- "Name=.cgifields", "Value=saveCC", ENDITEM,
- "Name=buyFlights.x", "Value=63", ENDITEM,
- "Name=buyFlights.y", "Value=14", ENDITEM,
- LAST);
- // 插入订票结束事务
-
- lr_end_transaction("订票", LR_AUTO);
-
-
-
- // 退出
- web_url("SignOff Button",
- "URL=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1",
- "TargetFrame=body",
- "Resource=0",
- "RecContentType=text/html",
- "Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=flights",
- "Snapshot=t7.inf",
- "Mode=HTML",
- LAST);
-
- return 0;
- }