DEV Community

Discussion on: Practical Puppeteer: How to evaluate XPath expression

Collapse
 
sabberworm profile image
Raphael Schweikert • Edited

Thanks for this. I love XPath for these kinds of use-cases.
Yes, CSS selectors can be simpler and well-understood but they are also restricted on purpose to have good run-time characteristics to not bog down the browser for dynamic updates.
So there’s lots of things you can do with XPath that’s simply not possible with selectors (like finding text nodes or using axes to select up the tree instead of down.

Collapse
 
sonyarianto profile image
Sony AK

totally agree with this, XPath to the rescue and full flexibility :)