Page 1 of 1

Capture element without a specific attribute

Posted: Thu Sep 02, 2010 1:13 pm
by beterthanlife
Hi,

Im trying to find the correct rxpath for capturing an element which does not have a specific attribute (innertext).

Ive tried "body//td[@innertext='']" and "body//td[not(@innertext)]" but it fails to find it - the latter throws a parsing error.

Can you suggest a working method?

Re: Capture element without a specific attribute

Posted: Thu Sep 02, 2010 1:37 pm
by Support Team
Hi,

Sorry, but this is not possible. You can only check if an attribute value is the empty string. You cannot check if the attribute does not exist at all, i.e. if the value returned for that attribute is null.

I've added a feature request to our internal bug tracking tool to provides such functionality.

Regards,
Peter
Ranorex Team

Re: Capture element without a specific attribute

Posted: Thu Sep 02, 2010 2:31 pm
by beterthanlife
Thankyou for your quick response.

Ive watched both RxPath screencasts, however, neither mention how to reference an element by the attributes it does not have. Rather, they only describe how to get an element by attributes it (or its parent / child) does have.

Heres an example to further explain what I need:

<A>
<B C=1 />
<B C=2 />
<B/>
</A>

I want to capture any B elements which are children of A which do not have a C attribute.

I know this is possible through regular xpath (using "B[not(@C)]"), but the syntax doesnt work in RxPath. Is there a way to do this in RxPath?

Re: Capture element without a specific attribute

Posted: Thu Sep 02, 2010 2:32 pm
by beterthanlife
Thanks Peter.

Didnt notice your response had been edited before posting my last response.

Re: Capture element without a specific attribute

Posted: Fri Sep 03, 2010 7:10 am
by artur_gadomski
Can you get all the children of A, and then in the code exclude the ones where C=something or is not null?