Micro Focus QTP (UFT) Forums
Problem with Link count - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Problem with Link count (/Thread-Problem-with-Link-count)



Problem with Link count - mahadevan.swamy1 - 01-23-2011

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?


RE: Problem with Link count - sreekanth chilam - 01-23-2011

HI,

Use "CreationTime" instead of "index" for Browser object.


RE: Problem with Link count - UFTEnthusiast - 01-24-2011

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,


RE: Problem with Link count - mahadevan.swamy1 - 01-24-2011

Not working. Still turning up with linkcount of 0.


RE: Problem with Link count - cdesserich - 01-24-2011

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\)"