Find the broken link– QTP
Do you want to know whether a particular link is broken or a valid link?
Try this piece of code…
Set myservice=Nothing
Set myservice=CreateObject(“Microsoft.XMLHTTP”)
myservice.open “GET”, url, False
myservice.send ” “
If myservice.status399 Then
Print “Invalid Request” & chr(32) & myservice.status & chr(32) & url & chr(32) & myservice.responseText
Else
Print “Valid Request” & chr(32) & myservice.status & chr(32) & url & chr(32) & myservice.responseText
End If
Advertisement
June 12, 2010