Peng Yu wrote:
I tried your xpath in Seleinum IDE. But I doesn't work as expected. I
want to reduced the problem to a simpler task. How to match the
following structure where the text is "1"?
<label for="eid_2-s2.0-78650811198">
<span class="hidden-label">result</span>
1
</label>
I overlooked that the span as another child of the label contributes to
the contents of the label element so the normalized string value of the
label is not "1" but rather "result 1".
As for selecting that label with a path, I think we need to know whether
the contents of the span matters and is known, in that case you could use
//label[normalize-space() = 'result 1']
or whether you want to select the label independent of any span
contents. You could write stuff like
//label[text()[normalize-space() = '1']]
that should find above label element but it would also find labels with
several such text child nodes e.g.
<label>1<!-- some comment -->1</label>
or
<label>1<span>...</span>1</span>
--
Martin Honnen --- MVP Data Platform Development
http://msmvps.com/blogs/martin_honnen/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--