Multiple links testing with QTP

If there are multiple links on a web page how can we automate to open those link one by one using QTP?

Questions by bobby2768

Showing Answers 1 - 9 of 9 Answers

Arun

  • Jun 4th, 2014
 

By using child objects method we can get all the links.
After getting the link we can open them easily

  Was this answer useful?  Yes

ganesh

  • Nov 25th, 2014
 

Code
  1. systemUtil.Run"iexplore.exe","https://in.yahoo.com/?p=us"

  2. Browser("creationtime:=0").page("title:=.*").Sync

  3. Set odesc=description.Create

  4. odesc("micclass").value="link"

  5. set a=Browser("creationtime:=0").page("title:=.*").ChildObjects(odesc)

  6. print a.count

  7.  

  8. For i = 0 To a.count-1

  9. Print i

  10. a(i).click

  11. Browser("creationtime:=0").Back

  12. Next

  Was this answer useful?  Yes

shekar

  • Aug 24th, 2015
 

Code
  1. systemutil.Run  "www.gmail.com"

  2. Browser("name:=Gmail").Page("title:=Gmail").Sync

  3. Set obj=Description.Create()

  4. obj("micclass").value="Link"

  5. Set links=Browser("name:=.*").Page("title:=.*").ChildObjects(obj)

  6.  

  7.  For i=0 to links.Count-1

  8. text=links(i).GetROProperty("Text")

  9. msgbox text

  10. links(i).click

  11. wait 5

  12.  

  13. text1=browser("name:=.*").getroproperty("name")

  14. msgbox text1

  15. Browser("Create your Google Account").Back

  16. If not browser("name:=Gmail").Exist Then

  17.         Browser("name:=.*").Back

  18.         wait 5

  19.         Set links=Browser("name:=.*").Page("title:=.*").ChildObjects(obj)

  20. End If

  21. next

  22.  

  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