Page 1 of 1

XPath to a Text item with no text?

Posted: Thu Jun 09, 2011 9:04 pm
by Aracknid
I'm walking through a table's rows looking for cells in a specific column whose text value is nothing (blank, or no text has yet been entered). How can I do this? Here's what I tried and it is not working (error in code or no match in Spy)

So this works here:

Code: Select all

...../Table/element/element/element[4]/text 
It returns a rows cell 4 text object, which may or may not contain text, but I only want it if it actually has no text so I tried this:

Code: Select all

...../Table/element/element/element[4]/text[@text='']
And it doesn't work. It would work if I did this,

Code: Select all

...../Table/element/element/element[4]/text[@text='Aracknid']
so that's why I figured I could put nothing in between the single quote chars.

How do I achieve this with an XPath?

Thanks,

Aracknid

Re: XPath to a Text item with no text?

Posted: Thu Jun 09, 2011 9:08 pm
by Aracknid
Figures, the moment you post, you almost always figure it out on your own...

I just needed to do this:

Code: Select all

...../Table/element/element/element[4]/text[@text=null()]