Search code examples
hyperlinkhtmlqtphp-uft

Qtp uft count the links number on a webpage:Count function is not recognized


I'm trying to count the number of links in a web page, using QTP UFT version 14 build 1775, but the count function is not recognized, maybe it has been deprecated. If someone has an idea about the issue, i'll be thankful for your help.

The is the code that I used

Set desc=description.Create()
desc("micclass").value="Link"

Set objLink =Browser("creationtime:=0").Page("title:=.*").childobjects(desc)

msgbox bjLink.count

enter image description here


Solution

  • You have a typo in your code. You're setting the objLink reference then trying to get the Count property from bjLink. Change that to objLink.Count and it will work as expected

    Set desc=description.Create()
    desc("micclass").value="Link"
    
    Set objLink =Browser("creationtime:=0").Page("title:=.*").childobjects(desc)
    
    msgbox objLink.count