I am trying to get the text in the elements with li class ="tooltip icon-bed" from the below html and I expect to get value "2" in this example but I always get an empty value instead.
<div class="listing-info-mobile">
<p class="icon-location">
Residencial </p>
<div class="details">
<p class="price">
1,654,080 </p>
<ul class="features">
<li original-title="Recámaras" class="tooltip icon-bed">2</li>
<li original-title="Baños" class="tooltip icon-bath">1</li>
<li original-title="Superficie (m²)" class="tooltip icon-building-area">69</li>
</ul>
</div>
</div>
Here is the part of my code that is trying to get the text:
extract=driver.find_elements_by_xpath("//ul[@class='features']")
for item in extract:
print item.find_element_by_class(".//li[@class='tooltip icon-bed']").text
It seems to find the elements but text is always empty. Any idea?
driver.find_element_by_css_selector("ul.features > li.icon-bed").get_attribute("textContent")and let me know