I came across Good question ..... Write a script to only
download pdf's if there are 20 links on a page. Kindly reply
these type of questions are pretty challenging..

Answer Posted / arun kumar

just try using the below code may be it helps you.

long fp;
char *data;
unsigned long prmLen;

web_url("example.html",
"URL=http://www.trainingg.com/example.html",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);

//Truncate to zero length or create file for writing.
fp = fopen("c:\\temp\\my_file.pdf","wb");

//Set the parameter size large enough to save the data.
web_set_max_html_param_len("200000");

//Use web_reg_save_param with the correct boundary to
capture the data returned by the server.
web_reg_save_param
("FILED","LB=","RB=","Search=Body",LAST);

web_url("PDF",
"URL= http://www.trainingg.com/example/automate.pdf",
"TargetFrame=",
"Resource=0",
"RecContentType=application/pdf",
"Referer= http://www.trainingg.com/example.html",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);

//Get the download size.
lr_eval_string_ext("{FILED}", strlen("{FILED}"), &data,
&prmLen, 0, 0, -1);

//Write the data saved to an output file.
fwrite(data, prmLen, 1, fp);

//Close the file pointer.
fclose(fp);

Is This Answer Correct ?    0 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to automate a script in mainframes environment? I have the terminal emulator Add in. Describe in detail.

1692


Can launch two instances of qtp on the same machine?

583


Dear sir, i want to perform a QTP automated testing for mechancial engineering software like msc adams, msc nastran this softwares will help for mechanical engineering design analysis>> i know oad runner win runner, test director, QTp>> but i dont know how to use for automation

1585


Explain the features and benefits of quick test pro(qtp)?

516


Explain actions in qtp ?

559






What is QTP and the use of QTP in TD?

602


What are the views available in qtp?

592


What is fragmentation and paging?

1592


I want to do QTP Certification what is the pattern of Question paper.

1745


Explain the difference between call to action and copy action?

523


I need to obtain the parent of an object programatically, so if I have: winButton("aButton") I need to obtain the parent part: window("Window1").Dialog("Dialog1") so I can programatically create a string of the full name of the object to call it with an execute statement in QTP I would like to use something like: part[1] = "window(""Window1"")" part[2] = "dialog(""Dialog1"")" so I can do: exeLine = part[1]&"."&part[2]&"."&"winButton(""aButton"")" Execute exeLine Apart from keeping a record of the window/dialog hierarchy is there a parent or path function/ command Thanks Adrian

1574


Name the properties you would use for identifying a browser and page when using descriptive programming?

524


why you have standardized functions? plzzz guys with real time exp. do answer

1437


Hi, My name is kishan. I have good Conceptual Knowledge on QTP. In order to Boost up my Confidence Level, I want to do a Project oriented Training only on QTP in Hyderabad. Kindly Let me know which is the Best QTP Project Training Institute in Hyderabad. Thanks in Advance kishan

2058


Without using gui map editor we can recognize the application in winrunner ?

607