GeekInterview.com
Series: Subject:
Question: 93 of 737

Count Number of Links

How to count the number of links in web page using QTP Script?
Asked by: y.sarwesh | Member Since Nov-2008 | Asked on: Nov 18th, 2008

View all questions by y.sarwesh

Showing Answers 1 - 2 of 2 Answers


1) You can use Page checkpoint to find number of links in a web page.

2) Following can also do the same task:

Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Links = Browser("Browser").Page("Google").ChildObjects(oDesc)
NumberOfLinks = Links.Count()
Msgbox NumberOfLinks

Yes  1 User has rated as useful.
  
Login to rate this answer.
Manoj KS

Answered On : Jul 21st, 2011

This is for webpages...

Code
  1. Set Links = Browser("micclass:=Browser").Page("micclass:=Page"). Object.GetElementsByTagName("a")
  2. Msgbox "Total links: " & Links.Length

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.