Micro Focus QTP (UFT) Forums
Webpage....Link test - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Webpage....Link test (/Thread-Webpage-Link-test)



Webpage....Link test - shriqtp - 03-18-2010

Hi,

Stuck in web page link testing....

To test all the links in Webpage i am using following code:

Code:
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
oDesc("micclass").RegularExpression = True

Set Links = Browser( "title:= AAA.*").Page("title:= AAA.*").ChildObjects(oDesc )

msgbox Links.count   'ex we found 10 links

For i = 0 to Links.Count -1
        v_link = Links(i).GetRoProperty("text")
        Links(i).Click ' successfully clicks first link
Next

Issues:
(1) The abve code works ok for First link in web page but not working for next 9 links. i.e it click 1st link successfully but when going for next link click it fails......
--> can anybody suggest why? and how to resolve it?

(2) The browser & page properties always changes during runtime (dynamic) as:
Browser("AAA").Page("AAA").Link("AAA").Click (for the first link)
Browser("BBB").Page("BBB").Link("BBB").Click (for the Second link)
Browser("CCC").Page("CCC").Link("CCC").Click (for the third link)

--> can anybody suggest how to write code (DP) when brower/page title's/properties are changing with each link AND still we have to test all the links in webpage.

Please help...

Thanks
Shrini


RE: Webpage....Link test - manishbhalshankar - 03-18-2010

Hi Shrini,
Try this:
Code:
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"

Set Links = Browser( "micclass:= Browser").Page("micclass:= Page").ChildObjects(oDesc )

For i = 0 to Links.Count -1
  oDest("index").Value = i
  Browser( "micclass:= Browser").Page("micclass:= Page").Link(oDesc).Click
Next