Reputation: 270
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
//span[text()="Text here"]/preceding::li
Upvotes: 0
Views: 101
Reputation: 9058
Try this - //span[text()="Text here"]/parent::li
//span[text()="Text here"]/parent::li
Upvotes: 2