|
我现在用LR录制它自带的飞机订票系统,录制的是登陆过程的脚本,我的脚本如下:
Action()
{
web_url("mercuryWebTours",
"URL=http://127.0.0.1:1080/mercuryWebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
lr_think_time(8);
web_submit_form("login.pl",
"Snapshot=t2.inf",
ITEMDATA,
"Name=username", "Value=", ENDITEM,
"Name=password", "Value=", ENDITEM,
"Name=login.x", "Value=0", ENDITEM,
"Name=login.y", "Value=0", ENDITEM,
LAST);
lr_start_transaction("login");
lr_think_time(29);
web_submit_form("login.pl_2",
"Snapshot=t3.inf",
ITEMDATA,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=49", ENDITEM,
"Name=login.y", "Value=11", ENDITEM,
LAST);
lr_end_transaction("login",LR_AUTO);
lr_think_time(11);
web_image("SignOff Button",
"Alt=SignOff Button",
"Snapshot=t4.inf",
LAST);
return 0;
}
接着我就在企业查询器-控制台目录下创建了一个名叫sql的数据库,并为它创建了2个表,一个是 username ,一个是password.
第3步我就开始在LR的参数对话框新建了2个参数username 和password,并且做了连接数据库的操作,成功.然后我在录制的脚本进行参数话,回放出错,回放后的脚本如下:
Action()
{
web_url("mercuryWebTours",
"URL=http://127.0.0.1:1080/mercuryWebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
lr_think_time(8);
web_submit_form("login.pl",
"Snapshot=t2.inf",
ITEMDATA,
"Name=username", "Value=", ENDITEM,
"Name=password", "Value=", ENDITEM,
"Name=login.x", "Value=0", ENDITEM,
"Name=login.y", "Value=0", ENDITEM,
LAST);
lr_start_transaction("login");
lr_think_time(29);
web_submit_form("login.pl_2",
"Snapshot=t3.inf",
ITEMDATA,
"Name=username", "Value={username}", ENDITEM,
"Name=password", "Value={password}", ENDITEM,
"Name=login.x", "Value=49", ENDITEM,
"Name=login.y", "Value=11", ENDITEM,
LAST);
lr_end_transaction("login",LR_AUTO);
lr_think_time(11);
web_image("SignOff Button",
"Alt=SignOff Button",
"Snapshot=t4.inf",
LAST);
return 0;
} |
|