LR困惑已久的问题(坐等朋友帮助)
为什么我的脚本不用关联也可以回放成功呢?我做的对一个系统的登陆操作,登陆成功后会提示“欢迎XXX”,录制脚本的时候取消勾选自动关联项。
完成后的脚本中确实可以看到有jession的动态变换数字,但我没有进行手动关联,利用web_reg_find进行验证“欢迎XXX”,居然提示成功了,真是百思不得其解,往能够想通的朋友帮我解释一下,多谢!
以下是我这段的脚本:
Action()
{
web_reg_find("Search=Body",
"SaveCount=result_open",
"Text=用户名", //打开的登陆页中有"用户名"
LAST);
web_url("welcome",
"URL=http://192.168.2.22:8080/lighting/kingdee_web/welcome",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"URL=../resources/css/layout.css", "Referer=http://192.168.2.22:8080/lighting/login.jsp;jsessionid=2F838842765542243A7B8ED3FCF3DBFD", ENDITEM,
"URL=../resources/images/login.jpg", "Referer=http://192.168.2.22:8080/lighting/login.jsp;jsessionid=2F838842765542243A7B8ED3FCF3DBFD", ENDITEM,
"URL=../resources/images/login_input.gif", "Referer=http://192.168.2.22:8080/lighting/login.jsp;jsessionid=2F838842765542243A7B8ED3FCF3DBFD", ENDITEM,
"URL=/favicon.ico", ENDITEM,
LAST);
if(atoi(lr_eval_string("{result_open}"))>0)
{
lr_output_message("open the url successful!");
}
else
{
lr_error_message("open the urlfailed");
}
web_reg_find("Text=超级管理员", //录制脚本时以超级管理员登陆,登陆成功后的界面中有“超级管理员”
"SaveCount=loginresult1",
"Search=Body",
LAST);
web_submit_form("j_spring_security_check",
"Snapshot=t2.inf",
ITEMDATA,
"Name=j_username", "Value=super", ENDITEM,
"Name=j_password", "Value=zmj", ENDITEM,
EXTRARES,
"URL=resources/images/logo_shadow.gif", "Referer=http://192.168.2.22:8080/lighting/jsp/main.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.theme.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.base.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.core.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.resizable.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.accordion.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.button.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.autocomplete.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.datepicker.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.slider.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.dialog.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.selectable.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.tabs.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/themes/redmond/jquery.ui.progressbar.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/LeftBgImg.png", "Referer=http://192.168.2.22:8080/lighting/jsp/left.jsp", ENDITEM,
"URL=resources/js/my97/skin/WdatePicker.css", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/images/default/panel/white-top-bottom.gif", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/images/System/TopBgImg.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/images/System/TopBgImg2.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/images/System/TopButtonBg.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/10.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/16.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/60.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/88.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/65.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/26.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/68.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/34.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/images/OA.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
"URL=resources/css/images/System/TopButtonBg2.png", "Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp", ENDITEM,
LAST);
if(atoi(lr_eval_string("{loginresult1}"))>0)
{
lr_output_message("login successful!");
}
else
{
lr_error_message("Log on failed");
}
web_url("My97DatePicker.htm",
"URL=http://192.168.2.22:8080/lighting/resources/js/my97/My97DatePicker.htm",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp",
"Snapshot=t3.inf",
"Mode=HTML",
EXTRARES,
"URL=skin/whyGreen/datepicker.css", ENDITEM,
"URL=lang/zh-cn.js", ENDITEM,
"URL=skin/default/datepicker.css", ENDITEM,
"URL=skin/default/img.gif", ENDITEM,
LAST);
web_url("getFunction",
"URL=http://192.168.2.22:8080/lighting/kingdee_json/menu/getFunction?id=select%20ROLE_ID%20from%20role&_dt=1330588826764&_=1330588826764",
"Resource=0",
"Referer=http://192.168.2.22:8080/lighting/jsp/top.jsp",
"Snapshot=t4.inf",
"Mode=HTML",
LAST);
web_url("left.jsp",
"URL=http://192.168.2.22:8080/lighting/jsp/left.jsp",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.2.22:8080/lighting/kingdee_web/welcome",
"Snapshot=t5.inf",
"Mode=HTML",
EXTRARES,
"URL=../resources/css/layout.css", ENDITEM,
"URL=../resources/images/LeftBgImg.png", ENDITEM,
"URL=../resources/images/function1.png", ENDITEM,
"URL=../resources/css/images/System/LeftBgImg3.gif", ENDITEM,
"URL=../resources/images/function2.png", ENDITEM,
LAST);
web_url("main.jsp",
"URL=http://192.168.2.22:8080/lighting/jsp/main.jsp",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.2.22:8080/lighting/kingdee_web/welcome",
"Snapshot=t6.inf",
"Mode=HTML",
LAST);
web_url("load",
"URL=http://192.168.2.22:8080/lighting/kingdee_json/menu/load?id=34&_dt=1330588827718&_=1330588827718",
"Resource=0",
"Referer=http://192.168.2.22:8080/lighting/jsp/left.jsp",
"Snapshot=t7.inf",
"Mode=HTML",
LAST);
以下是回放时日志信息中的一部分:
Action.c(24): open the url successful!
。。。
login successful! 没人看到吗?自己顶一下 顶 顶 session这种东西LR会自动管理,通过也蛮正常的啊 谢谢5楼,我现在是要拿我们的系统试验一下关联的功能,现在这样子取消关联了也可以成功,就没法试验老 我没看到你这里有需要关联的东西啊,至于你脚本里这段
EXTRARES,
"URL=../resources/css/layout.css", "Referer=http://192.168.2.22:8080/lighting/login.jsp;jsessionid=2F838842765542243A7B8ED3FCF3DBFD", ENDITEM,
"URL=../resources/images/login.jpg", "Referer=http://192.168.2.22:8080/lighting/login.jsp;jsessionid=2F838842765542243A7B8ED3FCF3DBFD", ENDITEM,
"URL=../resources/images/login_input.gif", "Referer=http://192.168.2.22:8080/lighting/login.jsp;jsessionid=2F838842765542243A7B8ED3FCF3DBFD", ENDITEM,
"URL=/favicon.ico", ENDITEM,
这里确实有jsessionid,不过这个不影响, EXTRARES后面的那些东西都去掉,脚本应该照样能过,这些只是从服务器返回的一些.css和png文件,你向服务器发送的数据都存在ITEMDATA里面,这里或者URL里有动态数据的话,做关联才有用
个人理解,勿拍砖 你要看关联,做一个新增后修改就行了,这个肯定要关联的 如果服务器没有对sessionID进行校验,不做关联也可以吧? 7楼说的很正确 想研究关联?订票吧~
页:
[1]