For the complete documentation index, see llms.txt. This page is also available as Markdown.

Overview

Some pages require JavaScript rendering to fully load the contents. Our Rendering service spawns headless browsers to execute those page scripts before returning the response.

To enable JS Rendering, include the render=true parameter with your requests. The API will fetch the page using a headless browser instance. This feature is available on all plans.

In addition to JS rendering, you can use the wait_for_selector parameter to instruct the API to wait for a specific element to appear on the page, before returning the response. This is useful for pages where content appears with a higher delay. This parameter must be used in combination with render=true and will not work if specified on its own.

Passing JS Rendering as part of the URL

  • API REQUEST

curl --request GET \
  --url 'https://api.scraperapi.com?api_key=API_KEY&render=true&url=https://example.com/'
import requests

target_url = 'https://example.com/'
# Replace the value for api_key with your actual API Key.
api_key = 'API_KEY'

request_url = (
    f'https://api.scraperapi.com?'
    f'api_key={api_key}'
    f'&render=true'
    f'&url={target_url}'
)

response = requests.get(request_url)
print(response.text)
import request from 'node-fetch';

// Replace the value for api_key with your actual API Key.
const url = 'http://api.scraperapi.com/?api_key=API_KEY&render=true&url=https://example.com/';

request(url)
  .then(response => {
    console.log(response);
  })
  .catch(error => {
    console.error(error);
  });
  • ASYNC REQUEST

curl -X POST \
  -H "Content-Type: application/json" \
  -d '{
        "apiKey": "API_KEY",
        "url": "https://example.com/",
        "apiParams": {
          "render": "true"
        }
      }' \
  "https://async.scraperapi.com/jobs"
import requests

r = requests.post(
    url='https://async.scraperapi.com/jobs',
    json={
        # Replace the value for api_key with your actual API Key.
        'apiKey': 'API_KEY',
        'render': 'true',
        'url': 'https://example.com/'
    }
)

print(r.text)
  • PROXY MODE

Passing JS Rendering as part of the headers

  • API REQUEST

  • ASYNC REQUEST

  • PROXY MODE

Last updated