Quality Testing

Quality is delighting customers

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

hi,

 

 

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: 3541

Reply to This

Replies to This Discussion

Hi,

set a= description.create

a("micclass").value="links"

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

c=b.count

msgbox c

for i= 0 to c-1

d=b.getroproperty("name")

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. 

 

 

prithvi

dim obj_lnk, a
Hi,
Check for the below code:-
set linkobject=Description.Create
linkobject("html tag").value="A"
set a=Browser("Google").Page("Google").ChildObjects(linkobject)
linkcount= a.Count
MsgBox linkcount
Regards
Jayanthi Gunalan

Hi Jayanthi,

 

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

 

With Regards,

Prithvi

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

 

Regards,

Madhuri

hi madhuri

 

                          thank you for giving me an crystal clear idea 

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service