Hamza Torjmen
Hamza Torjmen

Reputation: 270

How to get li with a span text inside

I want to catch an li with inside there is a span with text :

<li>
<span>Text here</span>
</li>

I tried to do this with XPath : //span[text()="Text here"]/preceding::li but does not work

Upvotes: 0

Views: 101

Answers (1)

Grasshopper
Grasshopper

Reputation: 9058

Try this - //span[text()="Text here"]/parent::li

Upvotes: 2

Related Questions