I use selenium to parse a html, but have trouble getting only the parent text. The html snippet looks like:
<p>
<span>Who</span>
Mario
</p>
I get the element with
div.find_element_by_xpath('p/span[contains(text/(), "Who")]../').text.strip()
But this returns all text ("Who Mario") inside the p tag. How can i only retrieve the parent text (Mario) without .replace(), etc?