Skip to main content

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 & "     ======================================="
                Print "Outer Html - > " & oAllChild(i).outerhtml
                Print "innerhtml- > " & oAllChild(i).innerhtml           
                Print "Title : - > " & oAllChild(i).Title
                Print "classname: - > " & oAllChild(i).classname           
        Next
    End If
    If Err.number <> 0 Then Reporter.ReportEvent micfail,methodname,Err.number & " - " & Err.description
End Function

E.g: Call GetAllitemsbyTageName("SPAN")
      Call GetAllitemsbyTageName("DIV")

Comments