July 30, 2015
4:43 a.m.
Tim Browski schrieb am 29.07.2015 um 23:44:
For the following scenario find and find text cannot return the element. Is it intended functionality or a possible bug?
<a> <b> </b> <b> <c></c> </b> </a>
when element called with elm.find("b/c") or elm.findtext("b/c"), it returns None.
Works for me: In [1]: s='<a> <b> </b> <b> <c></c> </b> </a>' In [2]: from lxml import etree In [3]: elm = etree.fromstring(s) In [4]: elm.find("b/c") Out[4]: <Element c at 0x7f25140f25a8> In [5]: elm.findtext("b/c") Out[5]: '' Stefan