Finding controls by their children's properties

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
tmcpherson
Posts: 14
Joined: Tue Nov 08, 2016 4:24 pm

Finding controls by their children's properties

Post by tmcpherson » Thu Mar 23, 2017 5:39 pm

I'm attempting to write some xpath to efficiently find a dom control. The dom itself doesn't have unique properties, but one of the child elements does. I have the following xpath that finds it correctly:

/dom[@domain='stuff']//?[@tagname='candidate-home']//ancestor-or-self::dom

However, I remember seeing some syntax to shorten this. I don't remember exactly what the syntax was, but it looked something like

/dom[@domain='stuff' and ?[@tagname='candidate-home']]

Is that actually a thing, or am I completely making this up? I've tried that syntax (and similar) but ranorex spy doesn't like it.

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

Re: Finding controls by their children's properties

Post by krstcs » Thu Mar 23, 2017 7:15 pm

That's not a thing in Ranorex. Ranorex uses a subset of the full XPath spec.

In Ranorex, you need to use the "ancestor-or-self::<element-type>" or "parent::<element-type>" notation.
Shortcuts usually aren't...