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.
To join text in XPath the concat()
function can be used. This is useful when parsing HTML for data values that are distributed through multiple elements or attributes.
See this interactive example:
Note that concat()
only works with strings so it'll automatically try convert elements to their text()
values.