Reputation: 3270
I'm using xpath's contains function to find elements that contain some text, like this:
//td[contains(text(),'foo')]
But if the page, for example, contains two td
elements, that contain foo
and foo bar
respectively, the above xpath will return both of them.
Is there any kind of strict contains
, that will return only the element with text foo
, but not the one with foo bar
?
Upvotes: 1
Views: 1660
Reputation: 24167
By "strict contains" do you actually mean a simple equality test? If so you should be able to do that using //td[text() = 'foo']
.
Upvotes: 6