1,用LR
录制一个内部
网站的登录页面,用URL录制的。录制后并编辑的
脚本如下:
vuser_init()
{
web_set_max_html_param_len("1024");
//对cookie进行的关联// [WCSPARAM User_Cookie 62
xSGGhP3KdyMJGK53R66QMghW2sK1pp71CzF1LH3zVLJt4jcl5Dp!-882202093]
Parameter {User_Cookie} created by Correlation Studio
web_reg_save_param("User_Cookie",
"LB=Set-Cookie: JSESSIONID=G",
"RB=;",
"Ord=1",
"RelFrameId=1",
"Search=Headers",
LAST);
web_url("lab",
"URL=http://192.168.1.9/lab",
"Resource=0",
"Rec
ContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTTP",
LAST);
web_concurrent_start(NULL);
web_url("css1.css",
"URL=http://192.168.1.9/lab/css/css1.css",
"Resource=1",
"Referer=http://192.168.1.9/lab/LoginAction.do",
LAST);
web_url("button-dl.gif",
"URL=http://192.168.1.9/lab/images/button-dl.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://192.168.1.9/lab/LoginAction.do",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("bg3.jpg",
"URL=http://192.168.1.9/lab/images/bg3.jpg",
"Resource=1",
"RecContentType=image/jpeg",
"Referer=http://192.168.1.9/lab/LoginAction.do",
LAST);
web_url("loginbg.jpg",
"URL=http://192.168.1.9/lab/images/loginbg.jpg",
"Resource=1",
"RecContentType=image/jpeg",
"Referer=http://192.168.1.9/lab/LoginAction.do",
LAST);
web_concurrent_end(NULL);
//对当前关联的参数进行输出 lr_log_message("the init param is:%s", lr_eval_string("{User_Cookie}"));
web_submit_data("LoginAction.do",
"Action=http://192.168.1.9/lab/LoginAction.do",
"Method=POST",
"RecContentType=text/html",
"Referer=http://192.168.1.9/lab/LoginAction.do",
"Snapshot=t2.inf",
"Mode=HTTP",
ITEMDATA,
"Name=companyId", "Value=1", ENDITEM,
"Name=username", "Value={user}", ENDITEM,
"Name=password", "Value={passwd}", ENDITEM,
LAST);