Sometimes there may be a requirement to capture whole web page body and here is the code for this.
int MyFile;
char *TargetFileName = "C:\Users\pc\Desktop\Webpage.html";
Place web_reg_save_param before the web_url
web_url("EasyLoadrunner",
"URL= https://easyloadrunner.blogspot.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t11.inf",
"Mode=HTML",
LAST);
int MyFile;
char *TargetFileName = "C:\Users\pc\Desktop\Webpage.html";
Place web_reg_save_param before the web_url
web_url("EasyLoadrunner",
"URL= https://easyloadrunner.blogspot.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t11.inf",
"Mode=HTML",
LAST);
left and right boundaries should be empty to capture the whole body
lr_output_message("Page is: \r\n%s", lr_eval_string("{WholeWebPage}"));
Truncate to zero length or create file for writing the whole page
if ((MyFile = fopen(TargetFileName, "wb")) == NULL)
{
lr_error_message("Cannot open %s", TargetFileName);
return LR_FAIL;
}
print the captured Web page to an output file
fprintf(MyFile, "%s", lr_eval_string("{WholeWebPage}"));
fclose(MyFile);
web_reg_save_param("WholeWebPage", "LB=", "RB=", "Search=Body", "RelFrameID=1", LAST);
Now write the captured web page in to a filelr_output_message("Page is: \r\n%s", lr_eval_string("{WholeWebPage}"));
Truncate to zero length or create file for writing the whole page
if ((MyFile = fopen(TargetFileName, "wb")) == NULL)
{
lr_error_message("Cannot open %s", TargetFileName);
return LR_FAIL;
}
print the captured Web page to an output file
fprintf(MyFile, "%s", lr_eval_string("{WholeWebPage}"));
fclose(MyFile);
No comments:
Post a Comment