Text Validation When a Space is Not a Space

Ask general questions here.
Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Text Validation When a Space is Not a Space

Post by Fergal » Wed May 05, 2021 10:59 am

Ranorex 9.4.1

I have a test that
  1. Enters a random address value on a web app
  2. Assigns that address value to a variable
  3. Navigates to a different page on the app and validates that the address displayed on the app is equal to the address stored in the variable.
The validation is failing because the spaces in the address text on the app, are not the same as the spaces in the address stored in the variable. I suspect they have a different ASCII code.

How can I deal with that?

Thanks

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Text Validation When a Space is Not a Space

Post by odklizec » Wed May 05, 2021 11:25 am

Hi,

Well, I think you will have to write your own validation method, in which you replace "spaces" with the same spaces as in ref. file/string. This is what I'm doing in similar cases. I believe these spaces are not completely random? So simply find out, what's the difference and unify spaces in ref/cmp strings, before comparing them. What often helps is also trimming spaces in front and behind the string. This is often a problem in web-based apps.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: Text Validation When a Space is Not a Space

Post by Fergal » Wed May 05, 2021 11:34 am

Thanks for your help odklizec, I will work on that.

Welcome back, we missed you :)

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Text Validation When a Space is Not a Space

Post by odklizec » Wed May 05, 2021 11:50 am

You are welcome ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: Text Validation When a Space is Not a Space

Post by Fergal » Wed May 05, 2021 4:20 pm

How can I determine how the "spaces" are represented on the web app? The spaces from the text on the website, look the same as the spaces in my variable value, on the Ranorex report.

Thanks

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Text Validation When a Space is Not a Space

Post by odklizec » Wed May 05, 2021 4:41 pm

Hi,

Try to copy the value fron Ranorex Spy a paste it to good text editor (e.g. notepad++). Then check it in hexa mode.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Fergal
Certified Professional
Certified Professional
Posts: 455
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: Text Validation When a Space is Not a Space

Post by Fergal » Fri May 07, 2021 10:45 am

Thanks odklizec, that's very helpful.