Find the broken link– QTP

Posted On June 12, 2010

Filed under QTP

Comments Dropped leave a response

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.