Capture element without a specific attribute : Object Identification and Technologies

Capture element without a specific attribute

Technology specific object identification, supported applications, web technologies, and 3rd party controls.

Capture element without a specific attribute

Postby beterthanlife » Thu Sep 02, 2010 2: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?
beterthanlife
 
Posts: 3
Joined: Thu Sep 02, 2010 2:07 pm

Re: Capture element without a specific attribute

Postby Support Team » Thu Sep 02, 2010 2: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
User avatar
Support Team
Site Admin
 
Posts: 4289
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Capture element without a specific attribute

Postby beterthanlife » Thu Sep 02, 2010 3: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 2:07 pm

Re: Capture element without a specific attribute

Postby beterthanlife » Thu Sep 02, 2010 3:32 pm

Thanks Peter.

Didnt notice your response had been edited before posting my last response.
beterthanlife
 
Posts: 3
Joined: Thu Sep 02, 2010 2:07 pm

Re: Capture element without a specific attribute

Postby artur_gadomski » Fri Sep 03, 2010 8: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?
User avatar
artur_gadomski
 
Posts: 106
Joined: Mon Jul 19, 2010 7:55 am
Location: Copenhagen, Denmark


Return to Object Identification and Technologies

Who is online

Users browsing this forum: No registered users and 0 guests