Hello Ravi,
Thank you for your answer but i do not get it worked.
What i did, is adding the next line to your function:
TempStr = Replace(TempStr, "$", "\$")
I did this because the $-sign is also a character wich is used as a regular expression, which can cause my problem, i think...?
Then i started this in QTP:
Code:
Function NormalizeString(OrgStr)
Dim TempStr
TempStr = Replace(OrgStr, "\", "\\")
TempStr = Replace(TempStr, "*", "\*")
TempStr = Replace(TempStr, "+", "\+")
TempStr = Replace(TempStr, ".", "\.")
TempStr = Replace(TempStr, "$", "\$")
NormalizeString = Replace(TempStr, "?", "\?")
End function
Print NormalizeString ("DEPART Frankfurt to Acapulco3/27/2013SELECTFLIGHTDEPARTSTOPS Blue Skies Airlines 360 5:03non-stopPrice: $270 (based on round trip) Blue Skies Airlines 3617:10non-stopPrice: $271 (based on round trip) Pangaea Airlines 3629:17non-stopPrice: $274 (based on round trip) Unified Airlines 36311:24non-stopPrice: $281 (based on round trip)")
In the Print pop-up screen i get this string:
DEPART Frankfurt to Acapulco3/27/2013SELECTFLIGHTDEPARTSTOPS Blue Skies Airlines 360 5:03non-stopPrice: \$270 (based on round trip) Blue Skies Airlines 3617:10non-stopPrice: \$271 (based on round trip) Pangaea Airlines 3629:17non-stopPrice: \$274 (based on round trip) Unified Airlines 36311:24non-stopPrice: \$281 (based on round trip)
Ik put this string into this code:
Code:
If Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebTable("html tag:=TABLE", "Index:=8", "column names:=DEPART Frankfurt to Acapulco.*","innertext:=DEPART Frankfurt to Acapulco3/27/2013SELECTFLIGHTDEPARTSTOPS Blue Skies Airlines 360 5:03non-stopPrice: \$270 (based on round trip) Blue Skies Airlines 3617:10non-stopPrice: \$271 (based on round trip) Pangaea Airlines 3629:17non-stopPrice: \$274 (based on round trip) Unified Airlines 36311:24non-stopPrice: \$281 (based on round trip)").Exist(1) Then
Reporter.ReportEvent micPass, "OK",""
Else
Reporter.ReportEvent micFail, "NOK",""
End If
Then i got "NOK".
When i remove the innnertext object property i get an "OK".
When i use GetROProperty to get the innertext value it is exactly like i did use it, but why do i get no match?
Whats wrong in?
DEPART Frankfurt to Acapulco3/27/2013SELECTFLIGHTDEPARTSTOPS Blue Skies Airlines 360 5:03non-stopPrice: \$270 (based on round trip) Blue Skies Airlines 3617:10non-stopPrice: \$271 (based on round trip) Pangaea Airlines 3629:17non-stopPrice: \$274 (based on round trip) Unified Airlines 36311:24non-stopPrice: \$281 (based on round trip)