Here is the HTML:
<div class="discount-promo" style="" xpath="1">-50%<span class="text">2a Unidad</span></div>
I extract OK text from span:
s = root.find_element_by_xpath('.//div[@class="discount-promo"]//span[@class="text"]')
s.text
'2a Unidad'
but for text inside div:
d = root.find_element_by_xpath('.//div[@class="discount-promo"]')
d.text
'-50%\n2a Unidad'
for this case I need to extract exactly "-50%", or whatever other value it takes, without having to use regex, just by XPath.
regards