HP QTP Interview Question 26: How to return the number of links in a web page?

To count the number of links in a web page, Quality Assurance Engineer could use ChildObjects to get the link collection, then retrieve the properties for example number of links or any other objects on page.

Dim oDesc, oAllLinks, iNumberOfLinks
set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set oAllLinks = Browser("creationtime:=0").
Page("micclass:=Page").ChildObjects(oDesc)
iNumberOfLinks = aAllLinks.Count
msgbox iNumberOfLinks

1 comment:

Anonymous said...

we can handle this situavation without programming

we can use the standard output value on page and can get the number of link in the page

Common QTP Interview Questions