Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



I came across Good question ..... Write a script to only download pdf's if there are 20 links ..

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

I came across Good question ..... Write a script to only download pdf's if there are 20 links ..

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

I came across Good question ..... Write a script to only download pdf's if there are 20 links ..

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

I came across Good question ..... Write a script to only download pdf's if there are 20 links ..

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

Post New Answer

More QTP Interview Questions

can any one tell me the script to click on a button in the wintoolbar.

1 Answers  


will QTP accepts javascript?

14 Answers   AppLabs,


if interviewer asked about the framework used for automation how we will handle the question..means what should be the answer..plz help..which framework u r used in our company?

1 Answers   iGate,


What is the Maximum syncronization timeout in seconds in QTP 9.5

5 Answers   Polaris,


Is there anyway to automatically update the Datasource name in Database Checkpoints object when we migrate tests to a new release?

0 Answers   ADP, CTS,


what properties do use to identify a browser and page while using descriptive programming?

3 Answers   TCS,


hi i have one doubt is there any companies are taking correspandence courses plz leme know urjent

2 Answers  


hi friends can anyone tell me where can i find descriptive programming material please send me the link also,from which i can download the material

1 Answers  


Is there any relation between Keyword Driven Framework and Recording modes provided in QTP( whether Recording modes are applied on keyword driven framework or not?)

0 Answers   IBM,


Can any one give me some basic VB script used in QTP ?As i am new in QTP.Give sample VB script used in QTP? PLZ

3 Answers  


how to capture (or) checkpoint for chineese or any other language except english using QTP in a web page. ( my application have 24 language, how to check those lanugages using QTP? is it possible). Please let me know

3 Answers  


In qtp, explain what is keyword driven automation framework?

0 Answers  


Categories