Skip to main content

Posts

Showing posts from July, 2014

Verify Broken Links in Page using QTP

------------------------------------------------------------------------------------------------------------ Browser("Browser").Page("Page").Sync Set objLink = Description.Create objLink("micclass").Value = "Link" Set objAllLinks = Browser("Browser").Page("HomePage").ChildObjects(objLink) iTotalLnksCnt = objAllLinks.Count For iCurItr =0 to iTotalLnksCnt - 1 strURL = objAllLinks(iCurItr).GetROProperty("url") Set objWinHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") objWinHTTP.Open "GET", strURL, False objWinHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)" objWinHTTP.Send iReturnVal = objWinHTTP.Status If iReturnVal = 200 Then msgbox "Link - " & sURL & " Exists" ElseIf iReturnVal = 404 Then msgbox "Link - " & sURL & " is Broken" Else msgbox "C