selector

A pattern that targets HTML elements — used by CSS for styling and by scrapers for extraction.

Definition

A selector is a pattern that matches DOM elements. CSS selectors (e.g. div.post > h2.title) target elements for styling; libraries like BeautifulSoup, Cheerio, and Playwright reuse them for scraping. XPath is the more expressive alternative for traversal-heavy queries. Selectors are also the standard configuration knob in browser-automation and structured-extraction tools.

When to use

See also