Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your crawler sees an empty div. Crawling a JavaScript SPA with Playwright

TL;DR: On a client-rendered SPA, the HTML the server sends is a script tag and an empty <div id="root"> . An HTTP crawler parses that, finds no links and stops. Load each page in a headless browser (Playwright or Puppeteer), wait for it to render, read a[href] from the live DOM and queue what you find. If you want the data rather than the pages, the JSON API the app calls is usually the better…

The source material describes how to crawl a JavaScript Single Page Application (SPA) using Playwright. The HTML sent by the server for such a site is minimal, containing just a script tag and an empty div with id "root". Crawlers that parse this HTML find no links to follow, causing the crawl to stop. To overcome this, each page must be loaded in a headless browser, which renders the application and extracts hyperlinks from the live DOM. Playwright and Puppeteer are examples of such browsers.

The crawler should also respect a website's robots.txt file, which specifies which pages can be accessed. The maximum number of pages to crawl, page load delay, and whether to ignore certain routes can be configured. After setting up the Playwright environment, the crawler begins by fetching the site's robots.txt file and parsing it for rules. It then initializes a browser instance and a new page, setting up an event listener for resource requests.

As the crawler visits each URL, it loads the page, waits for the DOM to load, and extracts hyperlinks. These hyperlinks are stored in a queue, with duplicates removed. The crawler continues this process until it has visited the maximum number of pages or exhausts the queue. It also checks if the crawler is allowed to access a page based on the robots.txt rules. If a page fails to load, the crawler logs the error and continues.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

RentDera at RevenueCat Shipaton 2026: We Didn't Win, But We Shipped

Not every hackathon story ends with a trophy. Sometimes, it ends with a certificate, a live product, lessons you couldn't have learned by planning alone, and a reason to keep building.

  • RentDera, a rent management product, developed by Sanjay Sah
  • Participated in RevenueCat Shipaton 2026 hackathon
  • Continued development beyond hackathon despite not winning

Your Coding Agent Knows the Rule. So Why Does It Keep Breaking It?

You tell Claude Code not to modify a particular interface. It acknowledges the instruction. It fixes the code. A few sessions later, it makes the same mistake again. You add a rule to CLAUDE.md .

  • Claude Code follows instructions but fails to apply them consistently.
  • User provides guidance on testing procedures, yet agent ignores verification.
  • Adding more rules to CLAUDE.md doesn't guarantee agent will follow them.

More from Monday 26 October →