Quality Testing

Quality is delighting customers

How could we find how many links are there in a web page using QTP tool?




using qtp, how could we find how many links are there in a web page. 


eg. i have opened some web page which contains five hyper links in it. but in actual i dint know that five hyper links exists in that web page. so could you tell me, how to find it out.


Views: 3557

Reply to This

Replies to This Discussion


set a= description.create


set b=b().p().childobjects(a)


msgbox c

for i= 0 to c-1


msgbox d

hi vijay,


thank you very much for your response. but i dont understand the program. i am not a programmatic geek. but then thank you for your work.

the line which you had used in between set b=b().p().childobjects(a)

b() and p() --> are they functions. if so, then where is the code related to those functions and if you could provide me the explanation, that would be a lot helpful to me. 




Hi Jayanthi,


                Thank you and it would be help full to me if you could give me some explanation.


With Regards,


Hi anand

             thank you and you gave me an comprehensive idea of what it is

Hi Prithvi,

Simple steps to get number of links on a page are as below..

  1. First  create the description object.
  2. Next  give the property value used to identify your object(In our case its 'link').
  3. Next write the code for the page on which you want to find the number of links
  4. With the help of the child objects property we can get the number of objects holding particular description

simple code satisfying above points:

set linkobject=Description.Create --> This line is used to create description object
linkobject("Micclass").value="link" --> This line is used to identify the property.( In our case its link)
set a=Browser("Google").Page("Google").ChildObjects(linkobject) --> This line is used to return the childobjects having 'Linkobject' description.
linkcount= a.Count  ---> This line is used get number of links on a webpage
MsgBox linkcount


I hope that with above information you will get idea to get the number of links on a webpage




hi madhuri


                          thank you for giving me an crystal clear idea 


TTWT Magazine





© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service