Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to disable regular expressions in a text?
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
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)
Reply


Messages In This Thread
RE: How to disable regular expressions in a text? - by ttralor - 02-27-2013, 09:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
At Regular Expressions for e-mail address ganesh.dengale 6 19,191 08-23-2022, 02:51 PM
Last Post: ahmad3029
  Need help on using regular expressions on Java Window's title qa_tester 3 5,076 02-13-2012, 10:56 PM
Last Post: madsenfr
  java window titles & regular expressions jotdog2 1 4,226 02-13-2012, 10:55 PM
Last Post: madsenfr
  Process to use Regular Expressions in QTP using screen shots. yvslraotesting@gmail.com 1 3,509 01-31-2012, 12:45 PM
Last Post: basanth27
  Run error: Object is disable bea 5 11,691 01-11-2012, 12:45 AM
Last Post: sunnyk8

Forum Jump:


Users browsing this thread: 1 Guest(s)