4 ms·
The basics of XPath for web scraping
- tannhaeuser 5y ago> However, modern HTML is largely based on XML format, which means there is a better, more powerful way to find the exact elements one needs: XPath. XPath is an entire language created for traversing XML (and by extension HTML) element trees. Nope. Both HTML and XML are based on SGML. You can use XPath to traverse/query a DOM, though. While more powerful still, it's not clear XPath is better than CSS selectors for scraping and/or Selenium-like testing when CSS is already ubiquitous in web development.