DEV Community

Discussion on: Scraping a Web Page in Browser using XPath and Javascript

Collapse
 
grahamthedev profile image
GrahamTheDev • Edited

You should check out DOM parser - developer.mozilla.org/en-US/docs/W...

It will allow you to then use normal CSS selectors and querySelectorAll etc. to grab info which 99% of the time will be far easier and more robust as the xpath is far more likely to change on a document not using IDs.

Collapse
 
dendihandian profile image
Dendi Handian

Nice Info, I will try.

I usually working with Scrapy to scrap a web, so XPath is just the habit.

Collapse
 
grahamthedev profile image
GrahamTheDev

Never used Scrapy but I can certainly understand the usage of xpath as I used for ages. I find DOM parser much easier but probably because I am used to CSS.

I enjoyed the article!