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..
Answers were Sorted based on User's Feedback
Answer / trex
Set oLink = Description.Create
oLink("micclass").value = "Link"
Set oPage = Browser("title:=.*").Page("title:=.*").ChildObjects(oLink)
PdfCount = 0
For i = 1 To oPage.Count-1
oPdfFiles = oPage(i).getROProperty("url")
print oPdfFiles
If Right(oPdfFiles,4)=".pdf" Then
MsgBox oPdfFiles
count = count +1
End If
Next
MsgBox PdfCount
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / harsha
dim objIE
Set objIE = CreateObject("InternetExplorer.Application")
objIE.visible=true
objIE.Navigate "your url"
Set ObjDoc = objIE.Document
objhref=objdoc.documentElement.getElementsbyTagName
("a").item(0).href
if (Instr(objhref,".pdf")>0) then
objdoc.documentElement.getElementsbyTagName("a").item
(0).click
End if
This will download the pdf doc into the current opened
browser.
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / rajesh
Hi Arun,
I really thank you for your reply, however it seems to be
javascript.
can you please post the VB script. I did research on net and
could get the appropriate script.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / 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 |
Can any body help me to write descriptive program to find a cell value (say 2 row, 3rd column) in a datatable which is creating dynamically and statically
What are the Features & Benefits of Quick Test Pro ?
What is the differences between image check point and bit map check point?
Anybody explain me, the concept of checkpoint declaration in the QTP mainly for the Objects, Pages, Text and Tables ?
How many types of recording modes in the qtp?
what happen in object repository(shared)if we call an existing action from an external action ? and what happen in object repository(peraction)if we call an existing action from an external action ?
How Can I automate PDF forms using QTP9.2 ?
In an output value text checkpoint, where does the output value stored by default ?
What ate the Technologies supported by QTP?
What kind of errors can b handled in QTP in real time scenario?
i need qtp tutorial. pls send it to sridhar.k151@g mail.com
when you press a link it displays "the page cannot be displayed" then as a tester how you will find the problem,what type of problem must be it?