|
设置检查点并回放以下脚本,发现用正确的登录名和用错误的登录名登录系统后,都显示登录成功,不知道是什么原因造成的,是脚本有问题吗?我找了很久没找出来,麻烦各位高手帮忙一下,谢谢!
submit_login()
{ lr_think_time(71);
lr_rendezvous("login_rendezvous");
web_submit_data("logon.do;jsessionid=13A4DD4CAD9E636BC9F6FA2513B38891",
"Action=http://192.168.2.95:9000/kb/logon.do;jsessionid={CSRule_1_UID2}",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.2.95:9000/kb/",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=state", "Value=logon", ENDITEM,
"Name=userName", "Value={username}", ENDITEM,
"Name=password", "Value={password}", ENDITEM,
LAST);
lr_start_transaction("confirm page");
//web_add_cookie("treeConfig=0; DOMAIN=192.168.2.95");
/*web_reg_find("Fail=NotFound",
"Search=Body",
"SaveCount=num",
"Text=首 页",
LAST);
web_link("首页",
"Text=首页",
"Snapshot=t6.inf",
LAST);*/
web_reg_find("Text=当前用户:",
"Search=body",
LAST);
web_url("mainFrame.jsp",
"URL=http://192.168.2.95:9000/kb/mainFrame.jsp",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t3.inf",
"Mode=HTML",
EXTRARES,
"URL=include/images/top_1.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=include/images/down_3.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=include/images/button_head_down.gif", "Referer=http://192.168.2.95:9000/kb/title.jsp", ENDITEM,
"URL=include/images/top_2.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=include/images/down_1.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=include/images/down_2.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=include/images/down.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=include/images/right_tool.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=include/images/top.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=include/images/left_tool.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=common/treeselect/css/xtree2.css", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=common/treeselect/images/tree2/start_on.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=common/treeselect/images/tree2/L.png", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=common/treeselect/images/tree2/loading.gif", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=common/treeselect/images/tree/I.png", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
LAST);
web_url("treexml.jspx",
"URL=http://192.168.2.95:9000/kb/common/treeselect/treexml.jspx?type=2&nodeID=0&dataType=1&allKe=0&archiveKe=0&hideKe=0&curDate=Tue%20Aug%203%2008:36:38%20UTC+0800%202010",
"Resource=0",
"RecContentType=text/xml",
"Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1",
"Snapshot=t4.inf",
"Mode=HTML",
EXTRARES,
"URL=images/tree2/folder.png", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=images/tree2/Tplus.png", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
"URL=images/tree2/Lplus.png", "Referer=http://192.168.2.95:9000/kb/ke/keTree.do?state=list&dataType=2&showType=1", ENDITEM,
LAST);
lr_end_transaction("confirm page", LR_AUTO);
lr_log_message("用户名为:%s", lr_eval_string("{username}"));
lr_log_message("密 码:%s", lr_eval_string("{password}"));
if(strcmp(lr_eval_string("{num}"),"0")==0) {
lr_log_message("登录失败");
}
else {
lr_log_message("登录成功");
}
return 0;
} |
|