51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1287|回复: 5
打印 上一主题 下一主题

[原创] 录制回放时,那位大侠帮我看看啊,在线等解答....

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2010-10-12 20:34:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
vuser_init()
{
web_url("mercuryWebTours",
  "URL=http://127.0.0.1:1080/mercuryWebTours/",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t16.inf",
  "Mode=HTML",
  LAST);
web_url("mercuryWebTours_2",
  "URL=http://127.0.0.1:1080/mercuryWebTours/",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t17.inf",
  "Mode=HTML",
  LAST);
lr_think_time(9);
web_submit_form("login.pl",
  "Snapshot=t18.inf",
  ITEMDATA,
  "Name=username", "Value=jojo", ENDITEM,
  "Name=password", "Value=bean", ENDITEM,
  "Name=login.x", "Value=41", ENDITEM,
  "Name=login.y", "Value=13", ENDITEM,
  LAST);
web_submit_data("login.pl_2",
  "Action=http://127.0.0.1:1080/mercuryWebTours/login.pl",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?in=home",
  "Snapshot=t19.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=userSession", "Value=104243.497772377fDzcActpQVzzzzzHDcVHcpVtQf", ENDITEM,
  "Name=username", "Value=jojo", ENDITEM,
  "Name=password", "Value=bean", ENDITEM,
  "Name=JSFormSubmit", "Value=off", ENDITEM,
  "Name=login.x", "Value=41", ENDITEM,
  "Name=login.y", "Value=13", ENDITEM,
  LAST);
return 0;
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2010-10-12 20:34:41 | 只看该作者
Action()
{
lr_think_time(4);
web_image("Search Flights Button",
  "Alt=Search Flights Button",
  "Snapshot=t20.inf",
  LAST);
web_image("Search Flights Button_2",
  "Alt=Search Flights Button",
  "Snapshot=t21.inf",
  LAST);
web_url("reservations.pl",
  "URL=http://127.0.0.1:1080/mercuryWebTours/reservations.pl?page=welcome",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=search",
  "Snapshot=t22.inf",
  "Mode=HTML",
  LAST);
lr_think_time(22);
web_submit_form("reservations.pl_2",
  "Snapshot=t23.inf",
  ITEMDATA,
  "Name=depart", "Value=Frankfurt", ENDITEM,
  "Name=departDate", "Value=10/14/2010", ENDITEM,
  "Name=arrive", "Value=Sydney", ENDITEM,
  "Name=returnDate", "Value=10/17/2010", ENDITEM,
  "Name=numPassengers", "Value=2", ENDITEM,
  "Name=roundtrip", "Value=on", ENDITEM,
  "Name=seatPref", "Value=Aisle", ENDITEM,
  "Name=seatType", "Value=First", ENDITEM,
  "Name=findFlights.x", "Value=65", ENDITEM,
  "Name=findFlights.y", "Value=16", ENDITEM,
  LAST);
web_submit_data("reservations.pl_3",
  "Action=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/reservations.pl?page=welcome",
  "Snapshot=t24.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=advanceDiscount", "Value=0", ENDITEM,
  "Name=depart", "Value=Frankfurt", ENDITEM,
  "Name=departDate", "Value=10/14/2010", ENDITEM,
  "Name=arrive", "Value=Sydney", ENDITEM,
  "Name=returnDate", "Value=10/17/2010", ENDITEM,
  "Name=numPassengers", "Value=2", ENDITEM,
  "Name=roundtrip", "Value=on", ENDITEM,
  "Name=seatPref", "Value=Aisle", ENDITEM,
  "Name=seatType", "Value=First", ENDITEM,
  "Name=.cgifields", "Value=roundtrip", ENDITEM,
  "Name=.cgifields", "Value=seatType", ENDITEM,
  "Name=.cgifields", "Value=seatPref", ENDITEM,
  "Name=findFlights.x", "Value=65", ENDITEM,
  "Name=findFlights.y", "Value=16", ENDITEM,
  LAST);
web_submit_form("reservations.pl_4",
  "Snapshot=t25.inf",
  ITEMDATA,
  "Name=outboundFlight", "Value=181;2037;10/14/2010", ENDITEM,
  "Name=returnFlight", "Value=811;2037;10/17/2010", ENDITEM,
  "Name=reserveFlights.x", "Value=39", ENDITEM,
  "Name=reserveFlights.y", "Value=10", ENDITEM,
  LAST);
web_submit_data("reservations.pl_5",
  "Action=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
  "Snapshot=t26.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=outboundFlight", "Value=181;2037;10/14/2010", ENDITEM,
  "Name=returnFlight", "Value=811;2037;10/17/2010", ENDITEM,
  "Name=numPassengers", "Value=2", ENDITEM,
  "Name=advanceDiscount", "Value=0", ENDITEM,
  "Name=seatType", "Value=First", ENDITEM,
  "Name=seatPref", "Value=Aisle", ENDITEM,
  "Name=reserveFlights.x", "Value=39", ENDITEM,
  "Name=reserveFlights.y", "Value=10", ENDITEM,
  LAST);
lr_think_time(22);
web_submit_form("reservations.pl_6",
  "Snapshot=t27.inf",
  ITEMDATA,
  "Name=firstName", "Value=s", ENDITEM,
  "Name=lastName", "Value=d", ENDITEM,
  "Name=address1", "Value=f", ENDITEM,
  "Name=address2", "Value=g", ENDITEM,
  "Name=pass1", "Value=h", ENDITEM,
  "Name=pass2", "Value=ja", ENDITEM,
  "Name=creditCard", "Value=12", ENDITEM,
  "Name=expDate", "Value=10/18", ENDITEM,
  "Name=saveCC", "Value=<OFF>", ENDITEM,
  "Name=buyFlights.x", "Value=61", ENDITEM,
  "Name=buyFlights.y", "Value=13", ENDITEM,
  LAST);
web_add_cookie("MTUserInfo=hash&47&firstName&Joseph&expDate&%0A&creditCard&&address1&234%20Willow%20Drive&lastName&Marshall%0A&address2&San%20Jose%2FCA%2F94085&username&jojo; DOMAIN=127.0.0.1");
web_submit_data("reservations.pl_7",
  "Action=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
  "Snapshot=t28.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=firstName", "Value=s", ENDITEM,
  "Name=lastName", "Value=d", ENDITEM,
  "Name=address1", "Value=f", ENDITEM,
  "Name=address2", "Value=g", ENDITEM,
  "Name=pass1", "Value=h", ENDITEM,
  "Name=pass2", "Value=ja", ENDITEM,
  "Name=creditCard", "Value=12", ENDITEM,
  "Name=expDate", "Value=10/18", ENDITEM,
  "Name=oldCCOption", "Value=", ENDITEM,
  "Name=numPassengers", "Value=2", ENDITEM,
  "Name=seatType", "Value=First", ENDITEM,
  "Name=seatPref", "Value=Aisle", ENDITEM,
  "Name=outboundFlight", "Value=181;2037;10/14/2010", ENDITEM,
  "Name=advanceDiscount", "Value=0", ENDITEM,
  "Name=returnFlight", "Value=811;2037;10/17/2010", ENDITEM,
  "Name=JSFormSubmit", "Value=off", ENDITEM,
  "Name=.cgifields", "Value=saveCC", ENDITEM,
  "Name=buyFlights.x", "Value=61", ENDITEM,
  "Name=buyFlights.y", "Value=13", ENDITEM,
  LAST);
web_submit_form("reservations.pl_8",
  "Snapshot=t29.inf",
  ITEMDATA,
  "Name=Book Another.x", "Value=33", ENDITEM,
  "Name=Book Another.y", "Value=6", ENDITEM,
  LAST);
web_submit_data("reservations.pl_9",
  "Action=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
  "Snapshot=t30.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=Book Another.x", "Value=33", ENDITEM,
  "Name=Book Another.y", "Value=6", ENDITEM,
  LAST);
web_url("welcome.pl",
  "URL=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=itinerary",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?page=menu&in=flights",
  "Snapshot=t31.inf",
  "Mode=HTML",
  LAST);
web_url("welcome.pl_2",
  "URL=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=itinerary",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?page=menu&in=flights",
  "Snapshot=t32.inf",
  "Mode=HTML",
  LAST);
web_url("itinerary.pl",
  "URL=http://127.0.0.1:1080/mercuryWebTours/itinerary.pl",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=itinerary",
  "Snapshot=t33.inf",
  "Mode=HTML",
  LAST);
web_submit_form("itinerary.pl_2",
  "Snapshot=t34.inf",
  ITEMDATA,
  "Name=1", "Value=<OFF>", ENDITEM,
  "Name=2", "Value=<OFF>", ENDITEM,
  "Name=removeAllFlights.x", "Value=57", ENDITEM,
  "Name=removeAllFlights.y", "Value=7", ENDITEM,
  LAST);
web_submit_data("itinerary.pl_3",
  "Action=http://127.0.0.1:1080/mercuryWebTours/itinerary.pl",
  "Method=POST",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/itinerary.pl",
  "Snapshot=t35.inf",
  "Mode=HTML",
  ITEMDATA,
  "Name=flightID", "Value=0-1393703-ab", ENDITEM,
  "Name=flightID", "Value=4511556-2162934-sd", ENDITEM,
  "Name=.cgifields", "Value=1", ENDITEM,
  "Name=.cgifields", "Value=2", ENDITEM,
  "Name=removeAllFlights.x", "Value=57", ENDITEM,
  "Name=removeAllFlights.y", "Value=7", ENDITEM,
  LAST);
web_url("welcome.pl_3",
  "URL=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=menus",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?page=menu&in=itinerary",
  "Snapshot=t36.inf",
  "Mode=HTML",
  LAST);
web_url("welcome.pl_4",
  "URL=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=menus",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?page=menu&in=itinerary",
  "Snapshot=t37.inf",
  "Mode=HTML",
  LAST);
return 0;
}
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2010-10-12 20:34:54 | 只看该作者
vuser_end()
{

        lr_think_time(5);

        web_image("SignOff Button",
                "Alt=SignOff Button",
                "Snapshot=t38.inf",
                LAST);

        web_add_cookie("MSO=SID&1286885980; DOMAIN=127.0.0.1");

        web_add_cookie("MTUserInfo=firstName&Joseph&hash&47&lastName&Marshall%0A&address1&234%20Willow%20Drive&username&jojo&address2&San%20Jose%2FCA%2F94085; DOMAIN=127.0.0.1");

        web_image("SignOff Button_2",
                "Alt=SignOff Button",
                "Snapshot=t39.inf",
                LAST);

        return 0;
}
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2010-10-12 20:35:29 | 只看该作者
原代码就是这些,
是使用的LR中自带的sample,
使用的HTML录制方式
回复 支持 反对

使用道具 举报

该用户从未签到

5#
 楼主| 发表于 2010-10-12 21:41:01 | 只看该作者
已解决
回复 支持 反对

使用道具 举报

该用户从未签到

6#
发表于 2010-10-13 11:15:02 | 只看该作者
本帖最后由 cjp110212 于 2010-10-13 11:16 编辑

回复 5# chenwenzhe


    能不能说下是怎么解决的??再说一下详细的录制模式,我试了一下,录制不到你那个web_image函数。
而且我看着,你这个脚本中,好像有些动作做了两遍??比如登录、注销,等等,只要一个函数就能完成了吧?
你这个脚本中怎么都是有两个函数呢?
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-13 08:05 , Processed in 0.077004 second(s), 29 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表