|
本帖最后由 lemonantonio 于 2015-4-14 20:38 编辑
录制1个登录页面,开发的意见是需要带1个 JSESSIONID的 cookies,才能用脚本登录。
LoadRunner回放脚本时,请求登录后的页面,比如sidebar.jsp,总是重定向到login.jsp,即登录失败。
++++++++++
我目前的做法是:
关联了这个cookies,保存在1个变量HZHSession中。
web_reg_save_param("HZHSession","LB=Set-Cookie: JSESSIONID=","RB=; Path=/","Ord=1" ,LAST);
web_url("ade",
"URL=http://10.129.148.200:8080/ade/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t54.inf",
"Mode=HTTP",
LAST);
然后在请求登录页前,用这个变量设置cookie,或者直接写请求头,登录都无效,求帮忙指点一下
web_add_cookie("JSESSIONID={HZHSession}; PATH=/; DOMAIN=10.129.148.200");
web_add_header("Set-Cookie", "JSESSIONID={HZHSession}");
web_submit_data("login.jsp",
"Action=http://10.129.148.200:8080/ade/login.jsp",
"Method=POST",
"RecContentType=text/html",
"Referer=http://10.129.148.200:8080/ade/login.jsp;jsessionid={HZHSession}",
"Snapshot=t71.inf",
"Mode=HTTP",
ITEMDATA,
"Name=enPassword", "Value=K1uNtfo3P0JFHNT0QLePOlR5rBe+ufRNwHY5YPwbC6WfmtjDoIjVt3cyWb9ksCQe7/2ZVFQkHzUdFDnbbyQ3uHP0gCnwHTVNH3eMpOc/p9J0/q1TKCR8HeBW40TVolygkAFDutlq1W78ZnRCRBHBUS7/7oxV+htIJYQG8NCHCns=", ENDITEM,
"Name=captchaId", "Value=4145e690-e0e4-4a29-80fc-41c2afd353c7", ENDITEM,
"Name=username", "Value=HZH1", ENDITEM,
"Name=password", "Value=12345678", ENDITEM,
"Name=captcha", "Value=1111", ENDITEM,
LAST);
web_add_header("Set-Cookie", "JSESSIONID={HZHSession}");
web_url("sidebar.jsp",
"URL=http://10.129.148.200:8080/ade/common/sidebar.jsp",
"Resource=0",
"RecContentType=text/html",
"Referer=http://10.129.148.200:8080/ade/",
"Snapshot=t92.inf",
"Mode=HTTP",
LAST);
|
|