Loadrunner download_file样例

来源:互联网 发布:淘宝怎么扫码支付 编辑:程序博客网 时间:2024/06/11 13:59

#include "web_api.h"


Action()
{
 long fp;

 web_url("download.html",
  "URL=http://localhost/download.html",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Snapshot=t1.inf",
  "Mode=HTML",
  LAST);

 web_reg_save_param("Content",
  "LB=",
  "RB=",
  "SEARCH=BODY",
  LAST);

 web_link("click to download sample.zip",
  "Text=click to download sample.zip",
  LAST);

 fp = fopen("c:\\sample.zip", "wb");
 if(fp == 0)
 {
  lr_output_message("Open file error\n");
  return -1;
 }
 fwrite(lr_eval_string("{Content}"),
  web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE),
  1,
  fp);
 fclose(fp);

 return 0;
}

0 0
原创粉丝点击