user
user

Reputation: 195

XPATH: Select a node whose children do not containg some text

I'm trying to select a node whose children do not contain some specific text. For example:

<div class="b-margin">
    <div class="tag">Pt</div>
    <div class="tag">En</div>
</div>
<div class="b-margin">
    <div class="tag">Ru</div>
    <div class="tag">En</div>
</div>

How would i go about selecting the 'div class="b-margin"' nodes that do not have children with the text "Pt"?

Upvotes: 0

Views: 26

Answers (1)

supputuri
supputuri

Reputation: 14145

Here is the simple xpath.

//div[@class='b-margin' and not(div[.='Pt'])]

Screenshot: enter image description here

Upvotes: 2

Related Questions