Issue
I have a problem trying to get text in a <li>
because sometimes there is a <strong>
inside and sometimes there is not.
<div class="short-description" itemprop="description">
<div class="std">
<ul>
<li><span class="orange-caret"><i class="fas fa-caret-right"></i></span>Diseñada para trabajar con agua limpia como pueden ser bombeos de pozos y manantiales o en sistemas de riego</li>
<li><span class="orange-caret"><i class="fas fa-caret-right"></i></span>Uso industrial y agrícola</li>
<li><span class="orange-caret"><i class="fas fa-caret-right"></i></span>Altura máxima: <strong>30 m</strong></li>
<li><span class="orange-caret"><i class="fas fa-caret-right"></i></span>Flujo máximo <strong>120 L/min</strong></li>
<li><span class="orange-caret"><i class="fas fa-caret-right"></i></span>Profundidad de inmersión máxima: <strong>80 m</strong></li>
</ul>
</div>
</div>
Solution
Try:
response.xpath('//*[@class="std"]/ul/li//text()') #use .get() or .getall()
Answered By - Fazlul
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.