<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>110</id><slug>choosing-css-selectors-that-survive-redesigns-part-6-110</slug><title>Choosing CSS selectors that survive redesigns, part 6</title><excerpt>This is part 6 of our series, and this time we focus on edge cases readers asked about. 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>6</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>This is part 6 of our series, and this time we focus on edge cases readers asked about. 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>Common pitfalls</heading><paragraphs><item>Always identify your client honestly with a descriptive User-Agent, and keep your request rate modest. A crawler that behaves like a considerate visitor is far less likely to cause problems for the site operator.</item><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>Before writing a single line of code, look at how the page actually loads its data. Open the network panel, reload, and note which requests return the content you care about. Very often the data you want arrives as JSON from an endpoint you can call directly.</item></paragraphs></item><item><heading>What to watch for</heading><paragraphs><item>Treat HTTP 429 responses as a signal, not an obstacle. Read the Retry-After header, back off, and resume at a slower pace.</item><item>Deduplicate as you go. The same item often appears on several listing pages, and a stable identifier such as a SKU or ID makes duplicates easy to spot.</item><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></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>3</authorId><authorName>Priya Nakamura</authorName><authorSlug>priya-nakamura</authorSlug><category>Testing</category><tags><item>selenium</item><item>json</item><item>scrapy</item></tags><publishedAt>2025-11-23T00:00:00.000Z</publishedAt><wordCount>265</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
