vendredi 7 octobre 2016

nokogiri get text after tag within li element

I am working with nokogiri and I am trying to get the text within a li element that I identify with help of span element that contaings "Inhalt:". The text I want to get is "0,75l". This is the html code:

<li class="product--tax is-left">
   <span class="label--purchase-unit">Inhalt:</span>
0,75 l #text I want to get
</li>

If been trying this, however it doesn't seem to work:

doc.search("[text()*='Inhalt:']").parent.xpath('text()')

Aucun commentaire:

Enregistrer un commentaire