Micro Focus QTP (UFT) Forums

Full Version: Problem with Link count
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I was doing a small descriptive programming:

Code:
Set odesc = description.Create
odesc("micclass").value = "Link"
odesc("innertext").value =  "BlueDental Care(Prepaid)"

Set MyChildObj = Browser("index:=0").Page("index:=0").ChildObjects(odesc)
linkcount = MyChildObj.count

If linkcount > 0 Then
             Result = "PASS"
Else
    Result = "FAIL"
End If

I debugged this code on the page where the "BlueDental Care (Prepaid)" link was actually there but the linkcount returned 0. How is this possible?
HI,

Use "CreationTime" instead of "index" for Browser object.
Try with following code:
Hi

I was doing a small descriptive programming:

Code:
Dim odesc
Dim linkcount
Set odesc = description.Create()
odesc("micclass").value = "Link"
odesc("innertext").value = "BlueDental Care(Prepaid)"

Set MyChildObj = Browser("index:=0").Page("index:=0").ChildObjects(odesc)
linkcount = MyChildObj.count

If linkcount > 0 Then
Result = "PASS"
Else
Result = "FAIL"
End If

Thanks,
Not working. Still turning up with linkcount of 0.
All description properties are regular expressions by default. Your innertext property has parenthesis in it that are being treated as a regular expression capturing group instead of the literal characters. You can fix this in one of two ways. Either change the innertext property's regularExpression property to False, or escape the parenthesis to force them to be treated as literal strings.

1.
Code:
Set odesc = description.Create
odesc("micclass").value = "Link"
odesc("innertext").value = "BlueDental Care(Prepaid)"
odesc("innertext").regularExpression = False
2.
Code:
Set odesc = description.Create
odesc("micclass").value = "Link"
odesc("innertext").value = "BlueDental Care\(Prepaid\)"