issue with findtext and find

Hi, 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. However, when I call find with exact XPATH location it returns the expected result. Best, Tim

Tim Browski schrieb am 29.07.2015 um 23:44:
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

Tim Browski schrieb am 29.07.2015 um 23:44:
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
participants (2)
-
Stefan Behnel
-
Tim Browski