Match insensitive value

Ask general questions here.
jackrabbit
Posts: 47
Joined: Wed Mar 18, 2015 10:06 pm

Match insensitive value

Post by jackrabbit » Thu Nov 19, 2015 2:24 pm

In the page http://www.ranorex.com/support/user-gui ... xpath.html, I just realised that I can match a case insentive value:

Code: Select all

/form/button[?'add']
identifies button with any attribute containing the substring 'add' (case-insensitive)
I need to do something similar by specifying the attribute. When I try to find an object, the processname does not always show up with the same case.

On some computers I find the object with this:

Code: Select all

/form[@processname='Rapportfinancier' and ...]
On others I find the object with this:

Code: Select all

/form[@processname='RapportFinancier' and ...]
I tried putting the '?' everywhere in my condition but it does not accept it. Is there a way to match a case insensitive named attribute?

I know I could match it with "@processname~'^Rapport[fF]inancier$'", but I want to avoid this because the processname is received as a parameter to my function.

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

Re: Match insensitive value

Post by odklizec » Thu Nov 19, 2015 2:46 pm

Hi,

You must use something like this:

Code: Select all

/form[@processname~'^(?i:RapportFinancier)$']
Hope this helps?
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

jackrabbit
Posts: 47
Joined: Wed Mar 18, 2015 10:06 pm

Re: Match insensitive value

Post by jackrabbit » Thu Nov 19, 2015 4:57 pm

Thanks, it works!

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Match insensitive value

Post by krstcs » Thu Nov 19, 2015 8:44 pm

If you parametrize the value, make sure to quote everything correctly. I use ?i: all the time.

/button[@name~'(?i:' + $buttonName + ')']
Shortcuts usually aren't...