I want to extract text "3351500920037" from the following code:
<div class="specs">
<h3 class="h4">Productinformatie</h3>
<dl class="specs__list">
<dt class="specs__title">
Gewicht
</dt>
<dd class="specs__value">
0,3 kg
</dd>
<dt class="specs__title">
EAN
</dt>
<dd class="specs__value">
3351500920037
</dd>
</dl>
</div>
I use
ref_code = driver.find_element_by_xpath('//*[contains(text(),"EAN")]/following-sibling::dd').text
When I print ref_code seems taking the first line of the text only. It appears empty.
What I have:
print(ref_code)
I would like to have:
print(ref_code)
3351500920037
How can I take the whole text including next lines?
ref_codeand your expectations. Add please HTML in text format.