element may exist, if it does use it

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Marc
Posts: 10
Joined: Wed Feb 15, 2017 5:54 pm

element may exist, if it does use it

Post by Marc » Fri May 19, 2017 9:06 pm

I'm sure there's an answer to this somewhere, but after searching for an hour I haven't found it (and feel like I'm running in circles).

In a nutshell I have a ranoreXpath that *may* have an element in it (it also may not).
If the element is in the path && matches a particular criteria then I want that path chosen, if it does not match that criteria then I want that path ignored.

here is the snip that does not work:

Code: Select all

/element//element?[@visible='True' and @controlname='TabbedContainer_tabControl']//table
The problem is that I can still match @visible='False' because of the question mark. I can't make this a fixed element (no ?) because it may be a different earlier branch that is being followed (and so this element isn't even there).

I've also tried

Code: Select all

element//element?[@visible='True' and @visible~'^((?!False).)*$' and @controlname='TabbedContainer_tabControl']//table
to no avail.

Is there a way for me to ensure that if an element is in the path with a particular value (visible='False') in this case it will be excluded from selection criteria?

thanks,
-marc

Marc
Posts: 10
Joined: Wed Feb 15, 2017 5:54 pm

Re: element may exist, if it does use it

Post by Marc » Fri May 19, 2017 10:06 pm

Oh the joy of "Off by one" errors.

I was filtering on the wrong UI element :oops:

Now that I'm doing that correctly it's all working :)
(now to tackle that in some frames there are two tables separated by a 3 branch element tree, but the user needs to access both equally...)

Vaughan.Douglas
Posts: 254
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: element may exist, if it does use it

Post by Vaughan.Douglas » Mon May 22, 2017 4:01 pm

Rooted folders. Use them liberally.
Doug Vaughan