# Website Screenshot & PDF (`cellwright/website-screenshot`) Actor

Reliable full-page screenshots (PNG/JPEG) and PDFs of any public URL, in desktop, tablet and mobile viewports. Hides cookie banners, loads lazy images, never charges for failed pages.

- **URL**: https://apify.com/cellwright/website-screenshot.md
- **Developed by:** [Cellwright](https://apify.com/cellwright) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

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 examples already wired to this Actor's own input schema, see the [API](#api) section below.

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`).

# README

## Website Screenshot & PDF

Capture **reliable full-page screenshots (PNG/JPEG) and PDFs** of any public web page – in desktop, laptop, tablet and mobile viewports, in one run. Cookie banners are hidden, lazy-loaded images are loaded, and **you never pay for pages that fail**.

Built for monitoring, QA, archiving, reporting, visual regression and AI agents that need to "see" a page.

### Why this Actor

- **One record per URL × viewport** – success or a clear error with a reason. No silent gaps.
- **Failed pages are free.** Transient errors are retried twice automatically.
- **Clean captures:** common consent overlays (OneTrust, Cookiebot, Usercentrics, Quantcast, …) are hidden; you can hide extra elements via CSS selectors.
- **Full page, done right:** scrolls first so lazy images render; very long pages are capped at 20,000 px (flagged as `truncated`).
- **Retina mobile** viewport (390×844 @2x) and custom sizes like `1440x900`.
- **Dark mode** emulation, JPEG quality, extra delay for animations.

### Use cases

- **Bulk website screenshots** from a URL list – e.g. thumbnails for a directory, link previews, client reports.
- **Mobile vs. desktop checks** – the same page in up to 5 viewports in one run (responsive QA).
- **Monitoring and archiving** – schedule a task daily or weekly and keep a dated visual history of pages.
- **Web page to PDF** – save articles, terms or invoices as PDF for records.
- **AI agents and LLM workflows** – give a model a screenshot of the page it should judge.

### Input

| Field | Default | Description |
|---|---|---|
| `urls` | – | Pages to capture (`https://` is added if missing) |
| `viewports` | `["desktop"]` | `desktop` 1920×1080, `laptop` 1366×768, `tablet` 768×1024, `mobile` 390×844, or `WIDTHxHEIGHT` |
| `format` | `png` | `png`, `jpeg` or `pdf` |
| `fullPage` | `true` | Whole page instead of the visible area |
| `hideCookieBanners` | `true` | Hide common consent overlays |
| `scrollToBottom` | `true` | Trigger lazy-loaded content |
| `waitUntil` | `networkidle` | Falls back to `load` if the page never goes idle |
| `delayMs` | `0` | Extra wait before capture (max 30 s) |
| `hideSelectors` | – | Extra CSS selectors to hide |
| `darkMode` | `false` | `prefers-color-scheme: dark` |
| `jpegQuality` | `80` | 10–100 |
| `timeoutSecs` | `45` | Per page load |
| `maxConcurrency` | `3` | Parallel pages (1–10) |
| `respectRobotsTxt` | `true` | Skip pages disallowed by robots.txt |

Example:

```json
{ "urls": [{ "url": "https://example.com" }], "viewports": ["desktop", "mobile"], "format": "png" }
```

### Output

Screenshots are stored in the run's key-value store; each dataset record links to its file.

| Field | Description |
|---|---|
| `ok` | `true` on success; `false` with `error` and `errorType` (`input`, `robots`, `blocked`, `capture`) |
| `url`, `finalUrl` | Requested URL and URL after redirects |
| `screenshotUrl` | Direct link to the image/PDF |
| `key` | Key-value store record key |
| `statusCode`, `title` | HTTP status and page title |
| `viewport`, `width`, `height` | Viewport used |
| `pageHeight`, `truncated` | Full document height; `true` if capped at 20,000 px |
| `format`, `contentType`, `bytes` | File info |
| `takenAt` | UTC timestamp |

### Pricing

Pay per event: **one `screenshot` event per successful capture** (URL × viewport). Failed, blocked or skipped pages are not charged. You can set a maximum cost per run in Apify.

### FAQ

**How much does a screenshot cost?** USD 0.002 per successful capture (USD 2 per 1,000), plus Apify's small actor-start fee. Failed, blocked or skipped pages are free.

**Can I capture many URLs at once?** Yes – add as many URLs as you like; up to 10 pages are processed in parallel. Each URL × viewport becomes one dataset record.

**How do I get mobile screenshots?** Add `mobile` (390×844, retina) or `tablet` to `viewports`, or a custom size like `1440x900`.

**Can I save a web page as PDF?** Yes, set `format` to `pdf`.

**How do I download the images?** Each record has a `screenshotUrl`; all files are also in the run's key-value store. Export the dataset as CSV/Excel/JSON to get the link list.

**How do I take screenshots every day?** Save your input as a task and add an Apify schedule (e.g. daily at 06:00). Every run keeps its own dated files.

**Can I call it as a screenshot API?** Yes: `POST https://api.apify.com/v2/acts/cellwright~website-screenshot/run-sync-get-dataset-items?token=YOUR_TOKEN` with the input JSON returns the records (with image links) directly.

**Why is my full-page screenshot cut off?** Pages taller than 20,000 px are capped and flagged with `truncated: true`. Capture the visible area (`fullPage: false`) or a larger viewport instead.

**Does it work behind a login or on pages with CAPTCHAs?** No. Only public pages; bot-protected pages fail and are not charged.

### Fair use & limits

- Public pages only: no login, no CAPTCHA solving, no bypassing of bot protection. Pages that block automated browsers will fail (free).
- Private, internal and cloud-metadata addresses are refused.
- robots.txt is respected by default. Disable it only for sites you own or are allowed to capture.
- You are responsible for how you use captured content (copyright, terms of the captured site).

### Use with AI agents (MCP)

Works as a tool in the Apify MCP server: give an agent a URL, get back a link to the screenshot plus page title, status and final URL.

# Actor input Schema

## `urls` (type: `array`):

Pages to capture. 'https://' is added if missing. One output record per URL and viewport.

## `viewports` (type: `array`):

Presets: desktop (1920×1080), laptop (1366×768), tablet (768×1024), mobile (390×844, retina). Or custom 'WIDTHxHEIGHT', e.g. '1440x900'.

## `format` (type: `string`):

Image format or PDF.

## `fullPage` (type: `boolean`):

Capture the whole scrollable page (capped at 20,000 px) instead of just the visible viewport.

## `hideCookieBanners` (type: `boolean`):

Hides common consent overlays (OneTrust, Cookiebot, Usercentrics, …) with CSS.

## `scrollToBottom` (type: `boolean`):

Scrolls through the page before capturing so lazy-loaded images appear.

## `waitUntil` (type: `string`):

Navigation event to wait for. 'networkidle' falls back to 'load' if the page never goes idle.

## `delayMs` (type: `integer`):

Additional wait before capturing, e.g. for animations. Max 30000.

## `hideSelectors` (type: `array`):

Extra CSS selectors to hide, e.g. chat widgets or sticky headers.

## `darkMode` (type: `boolean`):

Emulates prefers-color-scheme: dark.

## `jpegQuality` (type: `integer`):

Only for JPEG. 10–100.

## `timeoutSecs` (type: `integer`):

Maximum time per page load. Failed pages are retried twice and never charged.

## `maxConcurrency` (type: `integer`):

How many pages to capture at once (1–10).

## `respectRobotsTxt` (type: `boolean`):

Skip pages disallowed by the site's robots.txt. Turn off only for sites you own or are permitted to capture.

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://www.wikipedia.org"
    }
  ],
  "viewports": [
    "desktop",
    "mobile"
  ],
  "format": "png",
  "fullPage": true,
  "hideCookieBanners": true,
  "scrollToBottom": true,
  "waitUntil": "networkidle",
  "delayMs": 0,
  "darkMode": false,
  "jpegQuality": 80,
  "timeoutSecs": 45,
  "maxConcurrency": 3,
  "respectRobotsTxt": true
}
```

# Actor output Schema

## `results` (type: `string`):

One item per processed input in the default dataset (JSON, CSV, Excel via the dataset export).

## `files` (type: `string`):

Generated files in the default key-value store (each dataset item links its file).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        {
            "url": "https://www.wikipedia.org"
        }
    ],
    "viewports": [
        "desktop",
        "mobile"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("cellwright/website-screenshot").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "urls": [{ "url": "https://www.wikipedia.org" }],
    "viewports": [
        "desktop",
        "mobile",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("cellwright/website-screenshot").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    {
      "url": "https://www.wikipedia.org"
    }
  ],
  "viewports": [
    "desktop",
    "mobile"
  ]
}' |
apify call cellwright/website-screenshot --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,cellwright/website-screenshot"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/nwQDebHcfDCQaJ1fo/builds/XG76KpgGdaGKKz1kV/openapi.json
