Wednesday, April 20, 2011

QTP Count the number of links in a page

' Get The Object
Set htmlObjCol_l=Browser("Oracle Applications Home").Page("Login").Object.links

' Count
Dim i
i=0

For each  element in htmlObjCol_l
    ' HTML Anchor element
    'MsgBox typename(element)
    'MsgBox typename(element.toString())
    MsgBox element
    'MsgBox element.toString()
     'MsgBox element.Name
    'Print to the Report
    Reporter.ReportEvent micPass,"Link : "&i,""&element.toString()&vbCrLf&vbCrLF&element.Name
    i=i+1   
Next
MsgBox "No of Links "&i

No comments:

Post a Comment

Please add value. Sharing is caring