Highlighted
Absent Member.. Absent Member..
Absent Member..
360 views

Strange behavior of string behavior using DP

Greetings.

I'm using DP to get the value of the text in a popup, and compare it to the expected result string.  The function to compare the 2 strings is:

Function VerifyPopups(NxPracticecaption, ExpectedMessage)

Dim ActualMessageTextRO

VerifyPopups = 0

If Dialog("text:="&NxPracticecaption).Exist(5) Then
    ActualMessageTextRO = Dialog("text:="&NxPracticecaption).Static("text:="&ExpectedMessage).GetROProperty("text")
    If (StrComp(ActualMessageTextRO,ExpectedMessage)) = 0 Then  'matched
        Exit Function
       End If
End If
    
MsgBox ("Message NOT found!!!")    
VerifyPopups = -1

 

 

The function has been working fine.  But it is currently failing, understandably, with the following:

"text:=This will delete all related item, tracking, order, return and surgery information, Are you sure\?" is the value of the text property according to Object Spy.

 

The Expected Message that is passed to the function is 

"text:=This will delete all related item, tracking, order, return and surgery information, Are you sure?", so I understand why the object isn't found.

 

However, if I pass the expected message as 

"text:=This will delete all related item, tracking, order, return and surgery information, Are you sure\?", as the OS is displaying, the object is still not found.  

 

The runtime error that UFT is returning is attached.   I'm stymied.

 

 

 

0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

Re: Strange behavior of string behavior using DP

You could try to identify it using wildcard characters like this -

ExpectedMessage = "This will delete all related item.*?"
ActualMessageTextRO = Dialog("text:="&NxPracticecaption).Static("text:="&ExpectedMessage).GetROProperty("text")

And See if it works ?


Accept as solution/Give Kudos to the author if the piece of information answered/helped you to solve your problem.
All the thoughts here are mine not related to my employer nor anyone.
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Strange behavior of string behavior using DP

HI ,

 

If you want to validate instring of the actual content, you can go with regular expression.

 

If you want to make sure the whole content matched, please try the below and share results.

1)Trim the both string before you compare.

2)Try Comparing in same case(lcase/ucase)

3)Verify the data type of the two strings in debug, if you see any difference, try to bring them on same data type and compare.

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Strange behavior of string behavior using DP

Did you try using some other property (like class, html tag etc.) in the Static object description instead of ExpectedMessage?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.