Skip to main content

Posts

Showing posts with the label Web Automation

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...

How to Get the Inner Html of a WebPage

'###################################################### '#  FunctionName : GetPageInnerHtml '# Purpose: To get  the innerhtml of a WebPage '# Created By :  Jay '######################################################     Sub GetPageInnerHtml()     On Error Resume Next     Set oPage = Browser("name:=XXXX").Page("title:=XXXX")        Print oPage.object.body.innerhtml        If Err.number <> 0 Then Reporter.ReportEvent micfail,methodname,Err.number & " - " & Err.description End Sub E.g: Call GetPageInnerHtml()

How to Get Properties for All Objects From WebPage using Tag Name

'###################################################### '#  FunctionName : GetAllitemsbyTageName '# Purpose: To get  all the objects by Tag Name '# Created By :  Jay '# Parameters : '# Notes: '# Last  Updated: '# Revision History: '######################################################      Function GetAllitemsbyTageName(sTagName)     On Error Resume Next     Set oPage = Browser("name:=XXXX").Page("title:=XXXX")     Set oAllChild=oPage.Object.getElementsByTagName(sTagName)     iChildCnt = oAllChild.length     Print "Count - > " & iChildCnt     If iChildCnt >=1 Then               For i = 0 to iChildCnt -1                            Print "================================ " & i & "...