Micro Focus QTP (UFT) Forums
Check specific links of a webpage - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Check specific links of a webpage (/Thread-Check-specific-links-of-a-webpage)



Check specific links of a webpage - rocky9 - 06-11-2015

Hi All,

How to check specific links of a webpage are working or not.


Let say in https://www.google.co.in/webhp?hl=en , header has links Gmail ,Images and Footer has links Advertising,Business,Account. Then how to check all the links are working or not using VBScript , QTP.

How to create description objects and get to that link and check the links are working or not.


RE: Check specific links of a webpage - venkatesh9032 - 06-11-2015

Step 1:
Create description of the links

Step 2:
Identify all the links in the page.

Step 3:
Keep for loop and inside the the for loop keep if cond and check whether the link exists. if exists click and write exit for. else fail.

snippet:

Code:
dim objlink
set objlink = description.create
objlink("micclass").value = "Link"
set objlinkcoll = Browser("Name:=.*").page("Title:=.*).childobjects(objlink)
'Msgbox objlinkcoll.count


for i=0 to objlinkcoll.count

'check ur link exists in loop

if (trim("abc") = objlinkcoll(i) then

objlinkcoll(i).click

exit for

else

print "fail"

Next
///Hope this works
Happy scripting