Reputation: 2753
I trying to parse a webpage and get all the content inside a div tag named div1. I tried ('div[@class="div1"]') which gives me the content below
<div class="div1">
<p>
something something <br>
abc<br>
def
</p>
</div>
However, I am trying to get everything that is inside the div tag, not including the div tag as shown below
<p>
something something <br>
abc<br>
def
</p>
Upvotes: 0
Views: 46
Reputation: 141
Try changing your xpath to
div[@class="div1"]/child::*
Quote from https://www.w3.org/TR/xpath/#location-paths:
child::*
selects all element children of the context node
Upvotes: 1