51Testing软件测试论坛
标题:
LR下载到本地文件为什么是0字节
[打印本页]
作者:
shenqunqun
时间:
2009-7-27 17:42
标题:
LR下载到本地文件为什么是0字节
以下脚本运行后,下载到本地文件为什么是0字节。
Action()
{
int flen;
long filedes;
char filename[1024];
web_submit_data("testrequest.jsp",
"Action=http://118.118.118.252:7001/DZSW/offline/testrequest.jsp?&&LINK_TYPE=00&&S_DOMAIN=118.118.118.252&&S_PORT=7001&&C_VER=2007052410&&C_MODE=0",
"Method=POST",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
ITEMDATA,
LAST);
lr_think_time(6);
web_set_max_html_param_len("335778");
web_reg_save_param("fil1ename", "LB=", "RB=exe", "SEARCH=BODY", LAST);
web_submit_data("linkhost.jsp",
"Action=http://118.118.118.252:7001/DZSW/offline/linkhost.jsp?nsh=430181707241756&&pwd=111111&&LINK_TYPE=00&&S_DOMAIN=118.118.118.252&&S_PORT=7001&&C_VER=2007052410&&C_MODE=0",
"Method=POST",
"RecContentType=application/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
EXTRARES,
"Url=basedata/softUpdate.jsp?FUNID=05&nsh=430181707241756&SBMM=111111&version=2&Version_flag=new3000&&LINK_TYPE=00&&S_DOMAIN=118.118.118.252&&S_PORT=7001&&C_VER=2007052410&&C_MODE=0", "Referer=", ENDITEM,
"Url=down/qy/ABC3000.exe", "Referer=", ENDITEM,
LAST);
strcat(filename,"e:\\");
strcat(filename,lr_eval_string("430981758014596"));/
flen = web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);
if(flen > 0)
{
if((filedes = fopen(filename, "wb")) == NULL)
{
lr_output_message("Open File Failed!", lr_eval_string("{filecontent}"));
return -1;
}
fwrite( lr_eval_string("{filecontent}"),flen,1,filedes );
fclose( filedes );
}
return 0;
}
作者:
sky_zhouw
时间:
2009-7-28 09:43
楼主你把web_reg_save_param("fil1ename", "LB=", "RB=exe", "SEARCH=BODY", LAST);
改为:web_reg_save_param("filename", "LB=", "RB=exe", "SEARCH=BODY", LAST);
试试看是否可以
作者:
sunhope800
时间:
2009-8-5 22:36
学习了
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2