Reputation: 1227
I'm trying to extract a span tag like this:
<span>Price: $500</span>
What's wrong with doc.xpath('//span[@contains(text(), "Price")]/text()')
?
It's saying it's an invalid expression.
Upvotes: 0
Views: 459
Reputation: 185640
Try this :
//span[starts-with(name(), 'Price')]/text()
or
//span[starts-with(., 'Price')]/text()
or
//span[contains(., 'Price')]/text()
or
//span[contains(name(), 'Price')]/text()
Upvotes: 1