# Scrape JavaScript & SPA Sites with Headless Browser

**Use case:** 

Render dynamic React, Next.js, Vue, and Angular single-page apps in a managed headless browser and extract clean Markdown, rendered HTML, text, links, or metadata in bulk. Includes full Cloudflare, DataDome, and CAPTCHA unblocking with zero Playwright or Puppeteer ops. $0.80 per 1,000 successful rendered pages; failures free.

## Input

```json
{
  "startUrls": [
    "https://www.scrapingcourse.com/javascript-rendering",
    "https://quotes.toscrape.com/js/",
    "https://apify.com/store"
  ],
  "jsRender": true,
  "includeMetadata": false,
  "formats": [
    "markdown"
  ],
  "deliverMode": "perPost"
}
```

## Output

```json
{
  "url": {
    "label": "URL",
    "format": "link"
  },
  "fetch.loadedUrl": {
    "label": "Loaded URL",
    "format": "link"
  },
  "fetch.loadedTime": {
    "label": "Loaded Time",
    "format": "date"
  },
  "fetch.httpStatusCode": {
    "label": "HTTP Status",
    "format": "number"
  },
  "fetch.contentLengthBytes": {
    "label": "Content Length",
    "format": "number"
  },
  "fetch.contentType": {
    "label": "Content Type",
    "format": "text"
  },
  "metadata.canonicalUrl": {
    "label": "Canonical URL",
    "format": "link"
  },
  "metadata.title": {
    "label": "Title",
    "format": "text"
  },
  "metadata.description": {
    "label": "Description",
    "format": "text"
  },
  "metadata.author": {
    "label": "Author",
    "format": "text"
  },
  "metadata.keywords": {
    "label": "Keywords",
    "format": "text"
  },
  "metadata.languageCode": {
    "label": "Language",
    "format": "text"
  },
  "metadata.jsonLd": {
    "label": "JSON-LD",
    "format": "object"
  },
  "metadata.headers": {
    "label": "Headers",
    "format": "object"
  },
  "markdown": {
    "label": "Markdown",
    "format": "text"
  },
  "html": {
    "label": "HTML",
    "format": "text"
  },
  "text": {
    "label": "Text",
    "format": "text"
  },
  "links": {
    "label": "Links",
    "format": "array"
  },
  "raw": {
    "label": "Raw",
    "format": "text"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Web Unblocker & URL to Markdown: Cloudflare Bypass, PDF & Bulk Actor is ready to run with the inputs already set for "Scrape JavaScript & SPA Sites with Headless Browser". [Sign up or log in](https://console.apify.com/create-task-from-example/Nzojda3xdQwKT9j9T) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Scrape JavaScript & SPA Sites with Headless Browser" task

The Web Unblocker & URL to Markdown: Cloudflare Bypass, PDF & Bulk Actor will start running based on the input automatically. You can also change all the input fields, like URLs, render javascript, and more, to match your specific use case.

### 3. Receive the "Scrape JavaScript & SPA Sites with Headless Browser" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as URL, loaded url, loaded time, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Scrape JavaScript & SPA Sites with Headless Browser" task via API](https://apify.com/epctex/web-fetch.md).

## FAQ

### When should I use this headless browser task instead of standard fetch?

Use this preset (jsRender: true) for React, Vue, Angular, Next.js, or lazy-loaded pages where content is built client-side and missing from static HTML.

### How much does JavaScript-rendered scraping cost?

Headless browser rendering costs $0.80 per 1,000 successful pages ($0.0008/URL), discounting to $0.75/1K on Diamond—with anti-bot bypass included and no compute or proxy extras.

### How long does each headless browser fetch take?

A JavaScript-rendered fetch can take up to 120 seconds on heavy or heavily challenged pages, and runs across your full URL batch automatically.

### Should I mix static pages and SPAs in the same jsRender run?

No. Because jsRender applies to the whole run, split static pages and PDFs into a separate jsRender: false batch so they stay at $0.40 per 1,000 pages.

### Does headless browser mode also bypass Cloudflare and CAPTCHAs?

Yes. Anti-bot handling for Cloudflare, DataDome, Akamai, PerimeterX, Imperva, AWS WAF, and CAPTCHAs works seamlessly alongside JavaScript rendering.

### What if a JavaScript page times out or fails to load?

Failed fetches are logged as errors, omitted from the dataset, and never charged—you only pay for rendered pages that successfully return content.

## About this Actor

This example demonstrates how to use [Web Unblocker & URL to Markdown: Cloudflare Bypass, PDF & Bulk](https://apify.com/epctex/web-fetch.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/epctex/web-fetch.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/epctex/web-fetch.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
