Page 1 of 1

element may exist, if it does use it

Posted: Fri May 19, 2017 9:06 pm
by Marc
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

Re: element may exist, if it does use it

Posted: Fri May 19, 2017 10:06 pm
by Marc
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...)

Re: element may exist, if it does use it

Posted: Mon May 22, 2017 4:01 pm
by Vaughan.Douglas
Rooted folders. Use them liberally.