HTML
<span [@class="some class"]>
<h1> Some text
<a> another text </a>
</h1>
</span>
How can I write an XPath to get the text under h1
that doesn't contain the text inside the child a
?
HTML
<span [@class="some class"]>
<h1> Some text
<a> another text </a>
</h1>
</span>
How can I write an XPath to get the text under h1
that doesn't contain the text inside the child a
?
Try below XPath :-
//h1[not(self::a)]
OR
//span[@class='some class']//h1[not(self::a)]
Above XPath select everything excluding a tag
Hope it will help you :)