```yaml
product: AlterLab
title: "How to Scrape JavaScript-Rendered Pages (React, Vue, Angular) | AlterLab | AlterLab"
comparison_context: "AlterLab is an alternative to Firecrawl, ScrapingBee, and Bright Data."
source_url: https://alterlab.io/how-to/handle-javascript-rendered-pages
```

Beginner4 steps

# How to Scrape JavaScript-Rendered Pages

Single-page applications built with React, Vue, or Angular load content dynamically after the initial HTML response. A standard HTTP request returns an empty shell — you need full browser execution to get the actual content.

## Step-by-Step Guide

1

### Identify whether a page is JavaScript-rendered

View the page source (Ctrl+U) — if the body is mostly empty or contains only a root div, the content is JavaScript-rendered and requires browser execution.

2

### Enable JavaScript rendering in your request

Add `render_js: "auto"` to your AlterLab API request. AlterLab renders the page in a headless browser when it needs one, executing all JavaScript before returning the HTML. Use `render_js: true` to always force browser rendering, for example when waiting for a selector.

3

### Wait for dynamic content to load

Use the `wait_for` parameter to specify a CSS selector that appears only after the JavaScript has finished loading your target data.

4

### Extract data from the rendered HTML

Parse the fully rendered HTML response with your preferred HTML parser to extract the content that was previously invisible to standard scrapers.

## Code Example

Python

```
import requests

response = requests.post(
    "https://alterlab.io/api/v1/scrape",
    headers={"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"},
    json={
        "url": "https://example.com/spa-page",
        "render_js": True,
        "wait_for": ".product-list",  # Wait for this selector to appear
    },
)

data = response.json()
print(data["html"])  # Fully rendered HTML with dynamic content
```

Replace `YOUR_API_KEY` with your key from the . No credit card required.

## Try this yourself with AlterLab

Run this tutorial on live websites with AlterLab's API. New accounts get up to 5,000 free requests — no credit card required.

[View API docs](https://alterlab.io/docs/api/rest)

## Frequently Asked Questions

### What's the difference between render_js true and false?

Without render_js, AlterLab returns the raw HTTP response — fast but misses JavaScript-rendered content. With render_js: true, a full browser always executes all JavaScript and returns the complete DOM. With render_js: "auto" (recommended), AlterLab starts at the lowest tier that returns the page and renders in a browser only when the page needs it.

### How long does JavaScript rendering take?

Browser rendering typically adds 2–5 seconds per request compared to simple HTTP fetching. Use rendering only for pages that actually require it to keep costs low.

### Responsible Use

AlterLab is designed for extracting publicly available data. Always review the terms of service for any website you access, respect `robots.txt` directives, and ensure your use case complies with applicable laws in your jurisdiction.

### More tutorials

Browse all [how-to guides](https://alterlab.io/how-to) for web scraping — from beginner extractions to advanced multi-page pipelines.

## Your first scrape. Sixty seconds.

Up to 5,000 free requests — about 5,000 Light, 500 Protected or 250 Dynamic requests. No credit card. 
Just a POST request.

terminal

curl -X POST https://api.alterlab.io/v1/scrape \

-H "X-API-Key: YOUR_KEY" \

-H "Content-Type: application/json" \

-d '{"url": "https://example.com", "formats": ["markdown"]}'

[Start building free](https://alterlab.io/signin)

No credit card required · Up to 5,000 free requests (about 5,000 Light, 500 Protected or 250 Dynamic requests) · Balance never expires