Reputation: 147
I have HTML that looks like:
<div class="row">
<div class="col-md-6">
<dl>
<dt>Prerequisites</dt>
<dd>15-510</dd>
</dl>
</div>
<div class="col-md-6">
<dl>
<dt>Corequisites</dt>
<dd>None</dd>
</dl>
</div>
</div>
And I want to get the value inside <dd>
based on the corresponding <dt>
. For example, I want to do something like select 'Prerequisites' and get '15-510'.
Thank you.
Upvotes: 0
Views: 212
Reputation: 3691
How about xpath("//dt[text() = 'Prerequisites']/following-sibling::dd")
?
Upvotes: 1