脚本中没有session,如何自己关联session
在录制完成后,脚本中没有session,包括url中也没有,不知道有没有其他的办法能在脚本中关联session! 看了沙发只能自己坐了,有木有人啊! session是运行在服务器上的东西,表示用LR无解!!! session是运行在服务器上的东西,表示用LR无解!!! 没session你干嘛要关联啊?没关系就别处理了啊 是有关系的,系统中用了集群!录制的时候可能访问的tomcat1,而执行的时候可能进了其他的tomcat。。。不解决session,会导致失败! 话说,云层GG,我也买了你那本书! 如果有用,那么自然你访问你得负载均衡的时候会自动给你返回cookie,然后自动通过cookie来访问不同的负载均衡节点,你基本上还是不用管把?代码和具体的业务帖一下 本帖最后由 252090366 于 2011-8-17 17:47 编辑
恩,正如你说的那样!但是我想自己的代码里面来关联session,看是否能通过LR本身来解决问题!
=============================
代码如下:
Action()
{
web_url("eoms",
"URL=http://*.*.*.*:8081/eoms",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t82.inf",
"Mode=HTML",
LAST);
web_url("logon.do",
"URL=http://*.*.*.*:8081/eoms/logon.do",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t83.inf",
"Mode=HTML",
LAST);
flex_web_request("getMessageServer.jsp",
"URL=http://*.*.*.*:8081/eoms/portalLogon/getMessageServer.jsp?pg="
"portal",
"Method=GET",
"Resource=0",
"RecContentType=text/html",
"Referer=http://*.*.*.*:8081/eoms/logon.do",
"Snapshot=t84.inf",
"Mode=HTML",
"EncType=text/xml",
"Body=pg=portal",
LAST);
lr_rendezvous("login_rendezvous");
lr_start_transaction("login_transaction");
web_set_user("*.*.*.*\\admin","ynlteoms","*.*.*.*:8081");
web_submit_data("j_security_check",
"Action=http://*.*.*.*:8081/eoms/j_security_check",
"Method=POST",
"RecContentType=text/html",
"Referer=http://*.*.*.*:8081/eoms/logon.do",
"Snapshot=t85.inf",
"Mode=HTML",
ITEMDATA,
"Name=j_username", "Value=admin", ENDITEM,
"Name=j_password", "Value=ynlteoms", ENDITEM,
LAST);
web_concurrent_start(NULL);
web_url("WdatePicker.css",
"URL=http://*.*.*.*:8081/eoms/_script/DatePicker/skin/WdatePicker.css",
"Resource=1",
"RecContentType=text/css",
"Referer=http://*.*.*.*:8081/eoms/mainbody.do?type=getMenu",
"Snapshot=t86.inf",
LAST);
=====================
web_submit_data("j_security_check",
"Action=http://*.*.*.*:8081/eoms/j_security_check",
"Method=POST",
"RecContentType=text/html",
"Referer=http://*.*.*.*:8081/eoms/logon.do",
"Snapshot=t85.inf",
"Mode=HTML",
ITEMDATA,
"Name=j_username", "Value=admin", ENDITEM,
"Name=j_password", "Value=*******", ENDITEM,
LAST);
主要是这段代码,Action=http://*.*.*.*:8081/eoms/j_security_check,这个地址会去检查session,如果不正常系统会拒绝登陆,跳转到登陆页面,录制时,是没走到这一步的!所以在执行时,会造成访问这个页面出现问题,返回HTTP401。我只想自己在脚本中看能不能做SESSION的关联来解决这个问题!
chrome://livemargins/skin/monitor-background-horizontal.png chrome://livemargins/skin/monitor-background-vertical.png chrome://livemargins/skin/monitor-play-button.pngchrome://livemargins/skin/monitor-background-horizontal.png chrome://livemargins/skin/monitor-background-vertical.png chrome://livemargins/skin/monitor-play-button.pngchrome://livemargins/skin/monitor-background-horizontal.png chrome://livemargins/skin/monitor-background-vertical.png chrome://livemargins/skin/monitor-play-button.pngchrome://livemargins/skin/monitor-background-horizontal.png chrome://livemargins/skin/monitor-background-vertical.png chrome://livemargins/skin/monitor-play-button.png 提供个笨方法,用ie打开单独请求一个,抓包找到你说的类似sessionid的值,添加到脚本里 中间又有flex又有severlogin不好说了,你最好问问开发session怎么给客户端上得 flex_web_request("getMessageServer.jsp",
"URL=http://*.*.*.*:8081/eoms/portalLogon/getMessageServer.jsp?pg="
"portal",
"Method=GET",
"Resource=0",
"RecContentType=text/html",
"Referer=http://*.*.*.*:8081/eoms/logon.do",
"Snapshot=t84.inf",
"Mode=HTML",
"EncType=text/xml",
"Body=pg=portal",
LAST);
web_submit_data("j_security_check",
"Action=http://*.*.*.*:8081/eoms/j_security_check",
"Method=POST",
"RecContentType=text/html",
"Referer=http://*.*.*.*:8081/eoms/logon.do",
"Snapshot=t85.inf",
"Mode=HTML",
ITEMDATA,
"Name=j_username", "Value=admin", ENDITEM,
"Name=j_password", "Value=ynlteoms", ENDITEM,
LAST);
web_submit_data("j_security_check",
"Action=http://*.*.*.*:8081/eoms/j_security_check",
"Method=POST",
"RecContentType=text/html",
"Referer=http://*.*.*.*:8081/eoms/logon.do",
"Snapshot=t85.inf",
"Mode=HTML",
ITEMDATA,
"Name=j_username", "Value=admin", ENDITEM,
"Name=j_password", "Value=*******", ENDITEM,
LAST);
关键是这三个请求,每个检查下关联或者参数化对了吗??这三个请求按照你们的系统来看,提交数据过去,都会验证,如果不通过都会重定向到"Referer=http://*.*.*.*:8081/eoms/logon.do", action,所以建议先确定下提交的数据是否符合规则。。。。。。 回复 10# andrewXX
这个是添加到脚本中的什么位置呢? 中间又有flex又有severlogin不好说了,你最好问问开发session怎么给客户端上得
云层 发表于 2011-8-17 19:11 http://bbs.51testing.com/images/common/back.gif
flex那个只是在登录后显示的一个统计图表! flex_web_request("getMessageServer.jsp",
"URL=http://*.*.*.*:8081/eoms/portalLogon/getMess ...
wower1985 发表于 2011-8-18 11:32 http://bbs.51testing.com/images/common/back.gif
这里主要是部署了集群的原因,所以会导致session失效!因为我录制的时候可能使用的应用服务器1,而在正式执行时,通过集群的负载均衡又访问到了其他的应用服务器!所以最后造成了这种情况!
页:
[1]