How to get Links count in an web application,without
descriptive programming?

Answers were Sorted based on User's Feedback



How to get Links count in an web application,without descriptive programming?..

Answer / saidev

You can just palce page check point on that page,it will
give you the details like number of images ,number of links
etc in the page.

Is This Answer Correct ?    4 Yes 0 No

How to get Links count in an web application,without descriptive programming?..

Answer / chaitu

This Script is Helpfull to count the No.of links in a web
page

Step1: Set Objects = Browser("BrowserName").Page
("PageName").ChildObjects

Step2: Objectcount = Objects.count
Linkcount = 0
Step3: For i = 1 to Objectcount-1

Link = Objects(i).GetROProperty("micclass")
If Link = "Link" Then
Linkcount = Linkcount+1
msgbox Linkcount
End If
Next
msgbox Linkcount ' It show total number links

Is This Answer Correct ?    7 Yes 5 No

How to get Links count in an web application,without descriptive programming?..

Answer / raghava

Hi guys
Here we have to use the description object.Its working with
me.Just try it out.



Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Lists = Browser("Google").Page("Google").ChildObjects
(oDesc)
NumberOfLists = Lists.Count()
linkcnt = 0
For i = 0 To NumberOfLists - 1
linkcnt = linkcnt+1

Next
msgbox linkcnt

Regards
raghava

Is This Answer Correct ?    2 Yes 0 No

How to get Links count in an web application,without descriptive programming?..

Answer / priya

here is an example to get the link count in google page
Just try out this

SystemUtil.Run ("www.google.com")
Set Links = Browser("title:=.*").Page("title:=.*").Object.Links
Msgbox "Total links: " & Links.Length

Is This Answer Correct ?    1 Yes 0 No

How to get Links count in an web application,without descriptive programming?..

Answer / a

POSTED BY -CHAITU
This Script is Helpfull to count the No.of links in a web
page

Step1: Set Objects = Browser("BrowserName").Page
("PageName").ChildObjects

Step2: Objectcount = Objects.count
Linkcount = 0
Step3: For i = 1 to Objectcount-1

Link = Objects(i).GetROProperty("micclass")
If Link = "Link" Then
Linkcount = Linkcount+1
msgbox Linkcount
End If
Next
msgbox Linkcount ' It show total number links
--------------
This code is not working.

Check it out.
Link = Objec(i).GetROProperty("micclass")
Error is here.

Is This Answer Correct ?    1 Yes 1 No

How to get Links count in an web application,without descriptive programming?..

Answer / kalyan

'Hi, we can use "innertext" as a unique property of link.
'Name may be changes in the runtime. And we can use the
index number to identify the link in the execution.
(NOTE:-We dont use index to retrive the child objects.why
because each child object have different index number.)

TRY THIS CODE:--------THIS WIL WORK FINE.

set olink=description.create()
oDesc("micclass").Value = "Link"
set chobj=browser().page().childobjects(olink)
n=chobj.count

msgbox n

for i=0 to n-1
val1=chobj(i).getroproperty("innertext")
msgbox val1
Next


Any doubts----mail to------ mskalyan.smile@gmail.com

Is This Answer Correct ?    1 Yes 1 No

How to get Links count in an web application,without descriptive programming?..

Answer / venkatesh.m

Hi friends,

set odesc=description.create()
set odesce("htmltag").value="a"
set lists=browser("b.name").page("p.name").childobjects
(odesc)
set counter=lists.count
msgbox "total no.of links"& counter
for i=0 to counter-1 step 1
set link=lists(i).getroproperty("name")
msgbox link,0,"curren link is"
Next


The above script works correctly.

Is This Answer Correct ?    0 Yes 2 No

How to get Links count in an web application,without descriptive programming?..

Answer / sudhir

Hi Friends ,
Above Ans #5 gives syntax mismatch error.
Find below correct code.

set odesc=description.create()
oDesc("micclass").Value = "Link"
set lists=browser("Welcome: Mercury Tours").page("Find a
Flight: Mercury").childobjects(odesc)
counter=lists.count
msgbox counter
for i=0 to counter-1 step 1
name=lists(i).getroproperty("name")
msgbox name,0,"curren link is"
Next

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More QTP Interview Questions

hi, Can any body tell me whats the difference between the QTP and the Rational Robat ad the Silk Test and LOad Runner and are they used in any Company On the Major scale bcas I finnf Many comapny Using the Manual Testing Only Hence Askin the Question Hope I will get the Assitence .

1 Answers   First Europa,


HOW TO AUTOMATE CAPCHA IMAGES while creating Gmail account

2 Answers   TCS,


How we will execute(run) the scripts in qtp 8.2?

1 Answers  


Can any give an example(if possible templates) how to test web application using QTP. thanks in advance

0 Answers  


They asked by using qtp recording writing scripting

0 Answers   Wipro,






Explain about Checking Bitmaps?

1 Answers   Crea,


What is the difference between shared and local object repository?

0 Answers  


how to test Web application using QTP software

4 Answers   BITS,


i'm using the qtp to test to vb appliction,i wanted to get the new application's title.i didn't want to use the winAPI to get it ,i 'd like to know whether a QTP function can do it. Eg: SystemUtil.Run "C:\Program Files\.....","","","" 'run an application, and misure the application is activating,then how to get the hwn wihtout using windowns api

0 Answers  


What is InStr()

6 Answers   Kanbay,


Waht is diff between SystemUtil.Run and invokeapplication

5 Answers  


what is the Debug view?

1 Answers  


Categories