<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>118</id><slug>headless-vs-headed-browsers-part-6-118</slug><title>Headless vs headed browsers, part 6</title><excerpt>This is part 6 of our series, and this time we focus on edge cases readers asked about. Running a browser without a window is faster and works on servers, but some problems are much easier to…</excerpt><seriesName>Headless vs headed browsers</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. Running a browser without a window is faster and works on servers, but some problems are much easier to understand when you can watch the browser do its work.</item></paragraphs></item><item><heading>Step by step</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>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>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></paragraphs></item><item><heading>A practical approach</heading><paragraphs><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><item>Character encodings still cause trouble. Decode responses using the charset the server declares, and normalise text before comparing or storing it.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Develop headed with slow motion turned on, run headless in CI, and capture screenshots or traces on failure so headless runs are still debuggable.</item></paragraphs></item></sections><authorId>1</authorId><authorName>Amelia Okafor</authorName><authorSlug>amelia-okafor</authorSlug><category>Browser Automation</category><tags><item>testing</item><item>http</item><item>scrapy</item><item>ethics</item></tags><publishedAt>2026-01-14T00:00:00.000Z</publishedAt><wordCount>229</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
