Capture element without a specific attribute

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
beterthanlife
Posts: 3
Joined: Thu Sep 02, 2010 1:07 pm

Capture element without a specific attribute

Post by beterthanlife » Thu Sep 02, 2010 1:13 pm

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?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Capture element without a specific attribute

Post by Support Team » Thu Sep 02, 2010 1:37 pm

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
.
Image

beterthanlife
Posts: 3
Joined: Thu Sep 02, 2010 1:07 pm

Re: Capture element without a specific attribute

Post by beterthanlife » Thu Sep 02, 2010 2:31 pm

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?

beterthanlife
Posts: 3
Joined: Thu Sep 02, 2010 1:07 pm

Re: Capture element without a specific attribute

Post by beterthanlife » Thu Sep 02, 2010 2:32 pm

Thanks Peter.

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

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Capture element without a specific attribute

Post by artur_gadomski » Fri Sep 03, 2010 7:10 am

Can you get all the children of A, and then in the code exclude the ones where C=something or is not null?