Meaning of RanoreXPath specification

Ask general questions here.
Thet Thet
Posts: 21
Joined: Fri Jan 11, 2019 7:02 am

Meaning of RanoreXPath specification

Post by Thet Thet » Tue Jul 16, 2019 6:22 am

Hi,
I want to know the meaning of RanoreXPath specification.
Example,
/*
/?
//
@id
@accessiblename
#
.etc.

I want to also know the difference between .//input[#'LOGIN_USERCODE'] and .//input[@id='LOGIN_USERCODE'].
thank you.

User avatar
Julien Diot
Posts: 21
Joined: Wed Feb 20, 2019 4:25 pm
Location: Amiens (FR)

Re: Meaning of RanoreXPath specification

Post by Julien Diot » Tue Jul 16, 2019 7:50 am

Hi, look at this side, it'll give you some information.

https://www.ranorex.com/help/latest/ran ... -examples/

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

Re: Meaning of RanoreXPath specification

Post by odklizec » Tue Jul 16, 2019 7:50 am

Hi,

Have you checked Ranorex user guide yet? Of course, user guides are for noobs, but you know, sometimes, you can find surprisingly useful info in them ;) Seriously, check the user guide. Anything I, or anyone else, would answer here, would be just a reproduction of information, already available in the user guide...
https://www.ranorex.com/help/latest/ran ... blueprint/
https://www.ranorex.com/help/latest/ran ... escription
https://www.ranorex.com/help/latest/ran ... doperators

Don't forget on samples:
https://www.ranorex.com/help/latest/ran ... -examples/

And check also Ranorex xpath-related webinar...
https://www.ranorex.com/automated-testi ... norexpath/
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

Thet Thet
Posts: 21
Joined: Fri Jan 11, 2019 7:02 am

Re: Meaning of RanoreXPath specification

Post by Thet Thet » Tue Jul 16, 2019 9:06 am

Hi,
Thanks you for your reply. I checked Ranorex Userguide. But I can't see anything about #.
So, I don't understand well the difference between .//input[#'LOGIN_USERCODE'] and .//input[@id='LOGIN_USERCODE'].
Thanks you.

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

Re: Meaning of RanoreXPath specification

Post by odklizec » Tue Jul 16, 2019 10:02 am

Hi,

'#' means unique id, while '@id' means standard id attribute. The difference is, that unique id allows faster and more reliable element identification, as long as the id is not dynamic ;) The downside of using unique id in the xpath is, that it does not accept other attributes (like @visible and others), so the xpath must be constructed slightly differently. Typically, if the unique id is used, other attributes should not be required. Here is an examples:

To add visibility attribute to element with unique id, it must be done like this:
.//input[#'LOGIN_USERCODE'][@visible='True']

With standard id attribute, it can be done like this:
.//input[@id='LOGIN_USERCODE' and @visible='True']

Both xpaths are doing the same, but the one with unique id could be slightly faster and mainly, it should work even if you remove all preceeding xpath elements.
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