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.
Finding controls by their children's properties
-
- Posts: 14
- Joined: Tue Nov 08, 2016 4:24 pm
Re: Finding controls by their children's properties
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.
In Ranorex, you need to use the "ancestor-or-self::<element-type>" or "parent::<element-type>" notation.
Shortcuts usually aren't...