|
最近研究silk performer工具.
于是就拿MI LR自带的那个sample作为测试对象.
录制一个脚本登录后的代码.然后通过try script后自动关联sessionid,但是不管怎么样,就是不能获取返回值.
希望对这个工具熟悉或遇到这个问题的朋友给予帮助.下面是代码:
//----------------------------------------------------------------------
// Recorded 12/07/2004 by SilkPerformer Recorder v6.6.0.2138
//----------------------------------------------------------------------
benchmark SilkPerformerRecorder
use "WebAPI.bdh"
dclparam
session : string;
Sessvalue : string;
dcluser
user
VUser
transactions
TInit : begin;
TMain : 1;
var
sFormSid1 : string;
bVerifyTitleSuccess1 : boolean;
dclrand
dcltrans
transaction TInit
begin
WebSetBrowser(WEB_BROWSER_MSIE6);
WebModifyHttpHeader("Accept-Language", "zh-cn");
end TInit;
transaction TMain
var
begin
// WebParseDataBoundEx(session, STRING_COMPLETE, "", 0, "", WEB_FLAG_IGNORE_WHITE_SPACE | WEB_FLAG_CASE_SENSITIVE, 1);
WebUrlBeginPage("Mercury Tours");
//获取sessionid值:源代码:<input type=hidden name=userSession value=98011.5702713649fAtVtHApVtfiDDDDDActipicAiHf>
WebParseResponseData(Sessvalue,50,"value=",">");
//Print("session: " + session);
Print("Session:" +Sessvalue);
WebCookieSet("MTUserInfo=; path=/; expires=Tue, 29 Apr 2008 01:25:26 GMT", "http://xiaoyq:1080/mercuryWebTours/");
WebUrl("http://xiaoyq:1080/mercuryWebTours/");
WebUrl("http://xiaoyq:1080/mercuryWebTours/header.html");
WebParseResponseData(Sessvalue,50,"value=",">");
Print("Session:" +Sessvalue);
WebFormGet("http://xiaoyq:1080/mercuryWebTours/welcome.pl", MERCURYWEBTOURS_WELCOME_PL001);
WebParseResponseData(Sessvalue,50,"value=",">");
Print("Session:" +Sessvalue);
WebUrl("http://xiaoyq:1080/mercuryWebTours/images/mercury_logo.gif");
WebFormGet("http://xiaoyq:1080/mercuryWebTours/nav.pl", MERCURYWEBTOURS_NAV_PL002);
WebParseResponseData(Sessvalue,50,"value=",">");
Print("Session:" +Sessvalue);
WebUrl("http://xiaoyq:1080/MercuryWebTours/home.html");
WebUrl("http://xiaoyq:1080/MercuryWebTours/images/fma-gateway.jpg");
WebUrl("http://xiaoyq:1080/MercuryWebTours/images/mer_login.gif");
WebUrlEndPage(); // Mercury Tours
ThinkTime(9.0);
WebVerifyHtmlTitle("Welcome to Mercury Tours", WEB_FLAG_IGNORE_WHITE_SPACE | WEB_FLAG_EQUAL | WEB_FLAG_CASE_SENSITIVE, 1,
SEVERITY_ERROR, bVerifyTitleSuccess1);
WebUrlBeginPage("Mercury Tours (#1)");
sFormSid1 := Sessvalue;
WebFormPost("http://xiaoyq:1080/mercuryWebTours/login.pl", MERCURYWEBTOURS_LOGIN_PL003);
WebFormGet("http://xiaoyq:1080/mercuryWebTours/nav.pl", MERCURYWEBTOURS_NAV_PL004);
WebFormGet("http://xiaoyq:1080/mercuryWebTours/login.pl", MERCURYWEBTOURS_LOGIN_PL005);
WebUrl("http://xiaoyq:1080/MercuryWebTours/images/fma-performance-center.jpg");
WebUrl("http://xiaoyq:1080/MercuryWebTours/images/itinerary.gif");
WebUrl("http://xiaoyq:1080/MercuryWebTours/images/in_home.gif");
WebUrl("http://xiaoyq:1080/MercuryWebTours/images/signoff.gif");
WebUrl("http://xiaoyq:1080/MercuryWebTours/images/flights.gif");
WebUrlEndPage(); // Mercury Tours (#1)
end TMain;
dclform
MERCURYWEBTOURS_WELCOME_PL001:
"signOff" := "true";
MERCURYWEBTOURS_NAV_PL002:
"in" := "home";
MERCURYWEBTOURS_LOGIN_PL003:
// "userSession" := "97976.405508303fADQzzVpDfiDDDDDDAcDHpQziVf",
"userSession" := sFormSid1,
"username" := "jojo",
"password" := "bean",
"JSFormSubmit" := "off",
"login.x" := "28",
"login.y" := "9";
MERCURYWEBTOURS_NAV_PL004:
"page" := "menu",
"in" := "home";
MERCURYWEBTOURS_LOGIN_PL005:
"intro" := "true"; |
|