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: true` to your AlterLab API request. This triggers a full headless browser that executes all JavaScript before returning the HTML.

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

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 dashboard. No credit card required.

Ready to try it?

Run this tutorial on live websites with AlterLab's API. Start free — no credit card required.

Frequently Asked Questions

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 for web scraping — from beginner extractions to advanced multi-page pipelines.

Your first scrape.
Sixty seconds.

$1 free balance. No credit card. No SDK.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"]}'

No credit card required · Up to 5,000 free scrapes · Balance never expire

    How to Scrape JavaScript-Rendered Pages (React, Vue, Angular) | AlterLab | AlterLab