\n```\n\nBut after JavaScript runs, the browser DOM becomes:\n\n```html\n
\n
Product name
\n
\n```\n\nYour scraper only sees the first version unless it executes JavaScript.\n\n### Best approach\n- If the site has a backend API: scrape the API\n- If not: use Playwright or Selenium\n- If content appears after scrolling/clicking: automate those interactions\n\nIf you want, I can help you debug your specific scraper or show a Playwright/Selenium example."}}}

Prompt

Why is my website scraper failing on pages that load content with JavaScript?

Technology / API Platforms1 observationLast seen Oct 4, 2026

Latest observation

Oct 4, 2026OpenAI APIWeb search: off

Your scraper is probably failing because it’s only downloading the initial HTML returned by the server, but the content you want is added later by JavaScript in the browser.

What’s happening

Many modern websites work like this:

  1. Server sends a basic HTML shell
  2. JavaScript runs in the browser
  3. JavaScript fetches data from APIs and injects it into the page

If your scraper uses something like requests, urllib, fetch from the server side, or a basic HTML parser, it won’t execute JavaScript. So the HTML you see in the response may not contain the actual content.

Common symptoms

  • Page source looks almost empty
  • Data is visible in your browser but not in scraped HTML
  • Content appears only after a delay
  • Infinite scrolling / “load more” content is missing

How to fix it

1. Use a browser automation tool

Use a headless browser that executes JavaScript:

  • Selenium
  • Playwright
  • Puppeteer

These tools load the page like a real browser, wait for JS to finish, and let you extract the rendered DOM.

2. Scrape the API directly

Often the page is pulling data from a hidden JSON API. If you inspect network requests in DevTools, you may find:

  • REST endpoints
  • GraphQL queries
  • JSON responses

Scraping the API is usually faster and more reliable than scraping rendered HTML.

3. Wait for dynamic content

If you use Selenium/Playwright, you may need to wait for:

  • specific selectors to appear
  • network requests to finish
  • a fixed delay

4. Check for anti-bot protections

Some sites block scrapers with:

  • CAPTCHA
  • rate limiting
  • fingerprinting
  • bot detection

In that case, even a browser-based scraper may need:

  • slower request rates
  • session cookies
  • rotating IPs
  • proper headers/user-agent

Example

A requests.get() call might return:

<div id="app"></div>
<script src="bundle.js"></script>

But after JavaScript runs, the browser DOM becomes:

<div id="app">
  <div class="product">Product name</div>
</div>

Your scraper only sees the first version unless it executes JavaScript.

Best approach

  • If the site has a backend API: scrape the API
  • If not: use Playwright or Selenium
  • If content appears after scrolling/clicking: automate those interactions

If you want, I can help you debug your specific scraper or show a Playwright/Selenium example.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as Circuit. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.