Reputation: 18745
Is it possible to get all inner texts of some tag by XPath
?
For example, in one case, there could be text: root.xpath('//h2[text()="Description"]/following-sibling::p/span/span/text())
In another case, it could be in first span
: root.xpath('//h2[text()="Description"]/following-sibling::p/span/text())
So my question is, whether is there some way how to get all texts in one tag but not only on first level.
Something like root.xpath('//h2[text()="Description"]/following-sibling::p/*/text())
Upvotes: 1
Views: 387
Reputation: 89315
How about using //
axis ?
//h2[text()="Description"]/following-sibling::p/span//text()
This should return all text nodes, anywhere within the span
Upvotes: 2