Blog — Technique

How to scrape a website without writing a single XPath

XPath was state-of-the-art in 2010. Today it is a liability. Every CSS class rename breaks your selectors. Here is what replaces XPath for modern scraping.

Why XPath breaks every week

XPath and CSS selectors lock onto structural positions in the DOM: `div > div > ul > li:nth-child(3) > span`. The moment a developer adds a wrapper div, rearranges the menu, or ships an A/B test, your selector returns nothing.

For a tool like Amazon, that happens every 2-3 weeks. For LinkedIn, every week. For modern React stores, almost every deploy.

Pattern inference via LLM

Stekpad replaces XPath with pattern inference. When you click an element, Stekpad sends the DOM context around your click to a Gemma-3 model. Gemma returns a structural description — "the price label inside every product card in the grid" — not a brittle CSS selector.

At run time, Stekpad resolves the pattern against the current DOM. Class renames and wrapper additions do not break the match because the pattern describes intent, not position.

Self-healing recipes

When a pattern stops matching (the page has changed enough that the description no longer applies), Stekpad re-asks Gemma on the new DOM. Most of the time, the new description works and your recipe keeps running without you ever noticing.

When the site has changed fundamentally, Stekpad tells you and offers to re-teach the recipe with one click. No XPath to rewrite, no CSS to debug.

Keep exploring

Related on Stekpad

Same topic cluster

More in this cluster

Try Stekpad free

Install the Chrome extension. Free forever. €99 lifetime for Pro.

Scrape Any Website Without XPath or CSS Selectors — Stekpad