Count Number of Links

How to count the number of links in web page using QTP Script?

Questions by y.sarwesh

Showing Answers 1 - 3 of 3 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

Manoj KS

  • 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

  Was this answer useful?  Yes

Give your answer:

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

 

Related Answered Questions

 

Related Open Questions