I have a html
structure as follows.
<div id="description">
wanted text
<div class="text-smaller normal wine-user-description">
<a href = "/users/user1"> unwanted text</a>
</div>
</div>
I'm using selenium to open the url and extract the required text
from above block. Below is the code
val = self.driver.find_element_by_xpath('//div[@id="description"]').text
But the above code returns all the text (both wanted and unwanted). I even tried
val = self.driver.find_element_by_xpath('//div[@id="description"]/text()').text
but i get some xpath error. This is the first time i'm using selenium and i'm having some hard times. It would be really helpful if someone could help me.