Text field contains text and number, visible is number only

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Speedboat
Certified Professional
Certified Professional
Posts: 31
Joined: Wed Mar 25, 2015 4:44 pm
Location: Switzerland

Text field contains text and number, visible is number only

Post by Speedboat » Fri Sep 09, 2016 8:50 am

Hi

How is it possible that all usable attributes of text field are different to what is displayed?
The following example is from the Windows 10 Calculator result field.
Text: 'Display is 9'
Caption: 'Display is 9'
Visible: '9'

1) How is this technically possible
2) How to extract the number

Windows 10 / 64 bit
Ranorex 5.4.6

Thanks
Speedboat
Attachments
TextNumber.PNG
Result field example
TextNumber.PNG (62.42 KiB) Viewed 612 times

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

Re: Text field contains text and number, visible is number only

Post by odklizec » Fri Sep 09, 2016 9:10 am

Hi,

You can for example use Get Value action, with regular expression like this:
[0-9\.]+
This should return number (including decimal numbers) from given string.
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

Speedboat
Certified Professional
Certified Professional
Posts: 31
Joined: Wed Mar 25, 2015 4:44 pm
Location: Switzerland

Re: Text field contains text and number, visible is number only

Post by Speedboat » Fri Sep 09, 2016 11:59 am

However, any idea how this "effect" is constructed that the displayed value differs from attribute values?
"It sounds to me like a kind of misuse of windows objects"

Thanks for the regex

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

Re: Text field contains text and number, visible is number only

Post by odklizec » Fri Sep 09, 2016 12:11 pm

Sorry, don't have any clue how exactly this element is created. You know, it's a MS calculator, so virtually anything is possible ;) If I were you, I would not care much about this kind of problem. You are surely not going to test the MS calc app? ;)
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