Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check all links of a website
#1
Hi all,

i want to check whether all links of my web site are working fine using qtp
i have used standard checkpoint and selected an option check broken links
the code generated -

link check for google site
Code:
Browser("Google").Page("Google").Check CheckPoint("Google")
it is giving a fail result Sad

is there any other way in qtp to find out the broken links
thanks
sia


Attached Files Image(s)
   
Reply
#2
Try the below code
Code:
Set alllinkob = Description.Create() alllinkob("micclass").value ="Link" Set objAlllinkObj = Browser("Google").Page("Google").ChildObjects(alllinkob) For a =0 to objAlllinkObj.count-1 url = objAlllinkObj(a).getroproperty("url") call geturlstatus(url ) Next Public Function geturlstatus(url ) On Error Resume Next Call ClearBrowserCache() Set webService = nothing Set webService= CreateObject("Microsoft.XMLHTTP") ' Create an xmlhttp object webService.open "GET", url, False ' Opens the connection to the remote server webService.Send pagestatus = webService.status If pagestatus < 200 or pagestatus >399 Then print "In valid request" & pagestatus &"" & url geturlstatus = 0 else geturlstatus = 1 print "valid request"& pagestatus &"" & url End If Set webService = nothing err.clear End Function
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Check specific links of a webpage rocky9 1 3,255 06-11-2015, 06:23 PM
Last Post: venkatesh9032
  Get value from table out of a website Flooole 9 6,759 10-10-2013, 02:07 PM
Last Post: Flooole
  Menu is not displayed on the website to run QTP 11 jacosta 1 2,930 10-02-2012, 08:47 PM
Last Post: freeboynil
  Error opening the sample Mercury tours website akilashanmugam 0 3,097 06-15-2012, 04:43 PM
Last Post: akilashanmugam
Sad Mecury Tours Website suspended uherch 1 3,895 05-10-2012, 08:41 PM
Last Post: defcon3

Forum Jump:


Users browsing this thread: 1 Guest(s)