Ultimate XPath Cheatsheet for HTML Parsing in Web Scraping
Ultimate companion for HTML parsing using XPath selectors. This cheatsheet contains all syntax explanations with interactive examples.
XPath allows interacting with any element's attribute such as class
, id
, href
and any other through the @
syntax.
Attribute values then can be used in predicates using =
or contains()
. See these interactive examples:
Select attribute value, like the urls of <a>
links:
Or filter element based by attribute using contains()
function: