<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>70</id><slug>choosing-css-selectors-that-survive-redesigns-part-4-70</slug><title>Choosing CSS selectors that survive redesigns, part 4</title><excerpt>Part 4 looks at what changes when the same technique has to run every day in production. A selector that worked yesterday and fails today is usually a selector that depended on something nobody…</excerpt><seriesName>Choosing CSS selectors that survive redesigns</seriesName><seriesPart>4</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>Part 4 looks at what changes when the same technique has to run every day in production. A selector that worked yesterday and fails today is usually a selector that depended on something nobody promised to keep the same, such as a generated class name or the position of a div.</item></paragraphs></item><item><heading>Going further</heading><paragraphs><item>Dynamic pages render content after the initial HTML arrives. A browser automation tool can wait for a specific element to appear, which is far more reliable than sleeping for a fixed amount of time.</item><item>Store raw responses alongside parsed output while you are developing. When a parser breaks, you can replay the saved HTML instead of hitting the site again.</item></paragraphs></item><item><heading>Putting it into practice</heading><paragraphs><item>Selectors are the most fragile part of any scraper. Prefer stable attributes such as data-testid or semantic structure over generated class names, which can change on every deploy.</item><item>Pagination comes in several shapes: numbered pages, next links, offsets and opaque cursors. Each has trade-offs, and a robust scraper should detect the end of the result set rather than assuming a fixed number of pages.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Prefer data-testid attributes, ARIA roles and visible labels. Avoid long chains of nth-child and anything that looks like a hash.</item></paragraphs></item></sections><authorId>10</authorId><authorName>Aisha Rossi</authorName><authorSlug>aisha-rossi</authorSlug><category>Testing</category><tags><item>python</item><item>selenium</item><item>javascript</item></tags><publishedAt>2026-04-25T00:00:00.000Z</publishedAt><wordCount>195</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
