51Testing软件测试论坛
标题:
LR在html协议下如何实现上传文件?
[打印本页]
作者:
tangzhk
时间:
2007-8-16 10:13
标题:
LR在html协议下如何实现上传文件?
请问各位高手,如何在html协议下,用LR实现文件上传?
现在的状况是:其他项都可以填也可以选择,但就是“论文路径”这个空白无法填充指定的文件路径
运行结果是事务状态为“PASS”,但文件没有被上传
下面的图是LR的Run-time Viewer中的截图
[attach]31194[/attach]
麻烦高手指点。。。
附脚本
:
/* -------------------------------------------------------------------------------
Script Title :
Script Description :
Recorder Version : 1289
------------------------------------------------------------------------------- */
vuser_init()
{
web_add_cookie("UserID=157; DOMAIN=www.sqaclub.com");
web_add_cookie("Username=wangyong; DOMAIN=www.sqaclub.com");
web_add_cookie("onlineview=1; DOMAIN=www.sqaclub.com");
web_add_cookie("union=1; DOMAIN=www.sqaclub.com");
web_add_cookie("catlog=; DOMAIN=www.sqaclub.com");
web_add_cookie("screenmode=10; DOMAIN=www.sqaclub.com");
web_add_cookie("forumscookies=%2C28%2C15; DOMAIN=www.sqaclub.com");
web_add_cookie("amembernamecookie=tangzhk; DOMAIN=www.sqaclub.com");
web_add_cookie("apasswordcookie=lEOda1d36f284390037f4dd565a10c3aa63; DOMAIN=www.sqaclub.com");
web_add_cookie("templastvisit=28-1186975850--; DOMAIN=www.sqaclub.com");
web_add_cookie("lastvisit=28-1186976008--15-1186976643--; DOMAIN=www.sqaclub.com");
web_add_cookie("treeview=no; DOMAIN=www.sqaclub.com");
web_set_max_html_param_len("1024");
/* Registering parameter(s) from source task id 16
// {Siebel_Analytic_ViewState2} = "dDwyMDg3MjIzMDc1Ozs+WdQQpZGZfFuO+fZgk89IX6lG0sE="
// */
web_reg_save_param("Siebel_Analytic_ViewState2",
"LB/IC=ViewState\" value=\"",
"RB/IC=\"",
"Ord=1",
"Search=Body",
"RelFrameId=1",
LAST);
web_url("zp",
"URL=http://www.sqaclub.com/zp",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/ZP/DataImages/denglu.gif", "Referer=http://www.sqaclub.com/ZP/login/Index.aspx?ReturnUrl=%2fzp%2findex.aspx", ENDITEM,
"Url=/ZP/DataImages/quxiao.gif", "Referer=http://www.sqaclub.com/ZP/login/Index.aspx?ReturnUrl=%2fzp%2findex.aspx", ENDITEM,
LAST);
lr_start_transaction("登录");
lr_think_time(5);
web_submit_data("Index.aspx",
"Action=http://www.sqaclub.com/ZP/login/Index.aspx?ReturnUrl=%2fzp%2findex.aspx",
"Method=POST",
"TargetFrame=",
"RecContentType=text/html",
"Referer=http://www.sqaclub.com/ZP/login/Index.aspx?ReturnUrl=%2fzp%2findex.aspx",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=__VIEWSTATE", "Value={Siebel_Analytic_ViewState2}", ENDITEM,
"Name=ErrMsg", "Value=请勾选使用框,并插入USB_Key!", ENDITEM,
"Name=txtUsername", "Value=wangyong", ENDITEM,
"Name=txtPassword", "Value=pw", ENDITEM,
"Name=btnSubmit", "Value=", ENDITEM,
EXTRARES,
"Url=/webctrl_client/1_0/treeview.htc", "Referer=", ENDITEM,
"Url=/webctrl_client/1_0/treeimages/Fminus.gif", "Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx", ENDITEM,
"Url=/zp/DataImages/myDoc.gif", "Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx", ENDITEM,
"Url=/webctrl_client/1_0/treeimages/L.gif", "Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx", ENDITEM,
"Url=/webctrl_client/1_0/treeimages/I.gif", "Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx", ENDITEM,
"Url=/zp/DataImages/red_ball.gif", "Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx", ENDITEM,
"Url=/webctrl_client/1_0/treeimages/T.gif", "Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx", ENDITEM,
"Url=/zp/DataImages/message.gif", "Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx", ENDITEM,
"Url=/zp/DataImages/studentbs.gif", "Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx", ENDITEM,
LAST);
lr_think_time(16);
web_url("person.gif",
"URL=http://www.sqaclub.com/zp/Online.aspx",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.sqaclub.com/zp/left.aspx",
"Snapshot=t3.inf",
"Mode=HTML",
LAST);
lr_end_transaction("登录",LR_AUTO);
return 0;
}
Action()
{
lr_start_transaction("提交文档");
web_add_cookie("ActiveNodeID=0; DOMAIN=www.sqaclub.com");
web_url("Fplus.gif",
"URL=http://www.sqaclub.com/webctrl_client/1_0/treeimages/Fplus.gif",
"TargetFrame=",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx",
"Snapshot=t4.inf",
LAST);
/* Registering parameter(s) from source task id 186
// {Siebel_Analytic_ViewState9} = "dDwtMTcwNzc2OTAzO3Q8O2w8aTwxPjs+O2w8dDw7bDxpPDM+O2k8NT47PjtsPHQ8cDxwPGw8UmVhZE9ubHk7PjtsPG88dD47Pj47Pjs7Pjt0PHQ8O3Q8aTw0PjtAPOi9r+S7tua1i+ivlTvova/ku7bmqKHlvI876L2v5Lu26K6+6K6hO+avleiuvuWujOaIkDs+O0A8MTsyOzM7NDs+Pjs+Ozs+Oz4+Oz4+Oz7PoRrL+unXPpTWnfyoLU1btTWOsg=="
// */
web_reg_save_param("Siebel_Analytic_ViewState9",
"LB/IC=ViewState\" value=\"",
"RB/IC=\"",
"Ord=1",
"Search=Body",
"RelFrameId=1",
LAST);
web_url("Switch.aspx",
"URL=http://www.sqaclub.com/zp/Switch.aspx?Action=1&ClassID=106",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.sqaclub.com/zp/ProjectTreeView.aspx",
"Snapshot=t5.inf",
"Mode=HTML",
LAST);
web_reg_save_param("_ViewState",
"LB/IC=ViewState\" value=\"",
"RB/IC=\"",
"Ord=1",
"Search=Body",
"RelFrameId=1",
LAST);
web_submit_data("ZP_Upload.aspx",
"Action=http://www.sqaclub.com/zp/GPagingMg/ZP_Upload.aspx",
"Method=POST",
"EncType=multipart/form-data",
"TargetFrame=",
"RecContentType=text/html",
"Referer=http://www.sqaclub.com/zp/GPagingMg/ZP_Upload.aspx",
"Snapshot=t6.inf",
"Mode=HTML",
ITEMDATA,
"Name=__VIEWSTATE", "Value={Siebel_Analytic_ViewState9}", ENDITEM,
"Name=FileName", "Value=论文0815", ENDITEM,
"Name=Author", "Value=王勇", ENDITEM,
"Name=SourceList", "Value=2", ENDITEM,
"Name=upfile", "Value=C\:\\Documents\ and\ Settings\\tangzh\\桌面\\论文\.txt", "File=Yes", ENDITEM,
LAST);
web_url("Online.aspx",
"URL=http://www.sqaclub.com/zp/Online.aspx",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.sqaclub.com/zp/left.aspx",
"Snapshot=t7.inf",
"Mode=HTML",
LAST);
lr_end_transaction("提交文档",LR_AUTO);
return 0;
}
[
本帖最后由 tangzhk 于 2007-8-16 14:48 编辑
]
作者:
tangzhk
时间:
2007-8-16 14:33
ding~
作者:
423799223
时间:
2007-10-15 10:29
这样的帖子为什么班主不出来解答
好郁闷呀
作者:
nishizhu
时间:
2007-10-16 13:07
ding
作者:
sundy2016
时间:
2016-3-14 12:52
我也是同样的问题,事务pass,可是文件就是木有上传成功
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2