# Website Screenshot (PNG, JPEG, WebP, PDF) (`black-vikings/website-screenshot`) Actor

Capture screenshots of web pages in bulk: full page or viewport, desktop/laptop/tablet/mobile presets, one element, dark mode, hidden cookie banners and ads. PNG, JPEG, WebP or PDF. Blank pages and HTTP errors are never charged.

- **URL**: https://apify.com/black-vikings/website-screenshot.md
- **Developed by:** [Black Vikings](https://apify.com/black-vikings) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 screenshots

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-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 (PNG, JPEG, WebP, PDF)

Capture screenshots of many web pages in one run. Pick full page or viewport, a desktop, laptop, tablet or mobile preset, one element, dark mode, and hide cookie banners and ads. Get PNG, JPEG, WebP or PDF files with a public link for each one.

**You only pay for real screenshots.** Blank pages, HTTP errors (404, 500, ...), timeouts and unreachable sites are reported but never charged.

### What you can do with it

- **Bulk screenshots.** Paste up to 5,000 URLs. Pages are captured in parallel, each in a fresh browser session.
- **Full page or viewport.** Full-page captures include everything you can scroll to.
- **Device presets.** Desktop 1920x1080, Laptop 1366x768, Tablet 768x1024, Mobile 390x844 (mobile layout, touch), or any custom size. Use pixel density 2 or 3 for Retina-sharp images.
- **One element.** Capture just `#pricing`, `main` or any CSS selector.
- **Clean shots.** Hide your own selectors (chat widgets, sticky headers), common cookie banners, and ads.
- **Dark mode.** Ask pages for their dark color scheme.
- **Wait for content.** Wait for an element to appear, or add an extra delay for animations.
- **Formats.** PNG, JPEG and WebP with adjustable quality, or PDF.

Typical uses: visual monitoring, website archives, SEO and competitor reports, link previews, QA of responsive layouts.

### Input

| Field | What it does | Default |
|---|---|---|
| `urls` | Pages to capture. `https://` is added when missing. Duplicates are captured once. | required |
| `format` | `png`, `jpeg`, `webp` or `pdf`. | `png` |
| `fullPage` | Capture the whole scrollable page. Very tall pages are cut (see Output). | `false` |
| `viewport` | `desktop`, `laptop`, `tablet`, `mobile` or `custom`. | `desktop` |
| `viewportWidth`, `viewportHeight` | Size for `custom`. | |
| `deviceScaleFactor` | Pixel density 1, 2 or 3. | `1` |
| `quality` | JPEG and WebP quality, 1-100. | `80` |
| `selector` | Capture only the first element matching this CSS selector (not for PDF). | |
| `waitForSelector` | Wait until this element is visible. If it never shows up, the URL fails and is not charged. | |
| `delayMs` | Extra wait after loading, up to 30,000 ms. | `0` |
| `hideSelectors` | CSS selectors of elements to hide. | |
| `darkMode` | Emulate `prefers-color-scheme: dark`. | `false` |
| `dismissCookieBanners` | Hide common consent banners (OneTrust, Cookiebot, Quantcast, Didomi, Usercentrics and others). | `false` |
| `blockAds` | Skip well-known ad networks and hide common ad slots. | `false` |
| `timeoutSecs` | Page load timeout, 5-180 s. | `30` |
| `maxConcurrency` | Pages captured at the same time, 1-10. Lowered automatically to fit the run memory. | `2` |
| `userAgent` | Custom User-Agent. Empty = the browser's normal Chromium User-Agent. | |

Example:

```json
{
  "urls": ["https://example.com", "https://www.wikipedia.org"],
  "format": "webp",
  "fullPage": true,
  "viewport": "mobile",
  "deviceScaleFactor": 2,
  "dismissCookieBanners": true
}
```

### Output

Each file is saved in the run's default key-value store. The dataset gets one item per valid screenshot:

```json
{
  "url": "https://example.com/",
  "finalUrl": "https://example.com/",
  "statusCode": 200,
  "title": "Example Domain",
  "format": "png",
  "width": 1920,
  "height": 1080,
  "bytes": 88910,
  "screenshotUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/screenshot-0001-example-com-0f115db0.png",
  "key": "screenshot-0001-example-com-0f115db0.png",
  "capturedAt": "2026-11-24T10:00:00.000Z",
  "deviceScaleFactor": 1,
  "truncated": false
}
```

`width` and `height` are the real image size in pixels (CSS pixels for PDF). To stay reliable, one capture is limited to 40 million pixels and 16,383 pixels in height. Over that, the pixel density is first lowered to 1 (`deviceScaleFactor` shows the density used), then the page is cut (`truncated: true`). The **Overview** table in the dataset shows a thumbnail of each screenshot.

Every run also saves a summary in the `OUTPUT` record of the key-value store, with each failed URL and the reason:

```json
{
  "totals": { "requested": 3, "captured": 2, "failed": 1, "skipped": 0, "duplicatesRemoved": 0 },
  "chargeLimitReached": false,
  "averageCaptureMs": 1100,
  "failures": [{ "url": "https://example.com/missing", "reason": "http_error", "message": "The page answered with HTTP 404." }],
  "skipped": []
}
```

Failure reasons: `http_error`, `blank`, `timeout`, `navigation_error`, `selector_not_found`, `empty`, `capture_error`.

### Pricing

Pay per screenshot (event `screenshot`): $3.00 per 1,000 screenshots on the Free and Starter plans, $2.50 on Scale and $2.00 on Business. Blank captures, HTTP errors, timeouts and unreachable pages are never charged.

You are charged once for each valid screenshot saved (event `screenshot`). Failed URLs cost nothing. The run respects your maximum charge per run: it stops capturing when the limit is reached, keeps what it saved, and lists the remaining URLs as `skipped` in `OUTPUT`.

### When does a run fail?

- **Fails:** invalid input, every URL failed, or the maximum charge does not allow a single screenshot. Failed runs return no screenshots and are not charged.
- **Succeeds with a warning:** some URLs failed or were skipped. The run status and `OUTPUT` list them.

A capture counts as **blank** when almost every pixel has the same color (for example a white page that never rendered). It is not saved and not charged.

### Legal and responsible use

- **Only capture pages you have the right to capture.** You choose the URLs and are responsible for complying with the sites' terms, copyright and privacy law.
- The Actor visits public pages only, without logins or cookies, in a fresh browser session per URL.
- It does not solve CAPTCHAs, bypass paywalls or anti-bot protection, or rotate proxies to evade blocks. Pages that block automated browsers fail and are not charged.
- Cookie banners and ads are only **hidden** with CSS or not loaded. No consent is given or refused on your behalf.
- Private, local and reserved network addresses (localhost, 10.x, 192.168.x, 169.254.x, IPv6 local and IPv4-embedding forms) cannot be captured, also not through redirects, page resources, or host names that resolve to them.

### FAQ

**Why did a page fail as `blank`?** The page rendered as one flat color, usually because content loads late. Try `waitForSelector` or `delayMs`.

**A cookie banner is still visible.** Banner hiding covers common consent platforms only. Add the banner's selector to `hideSelectors`.

**Why is my full-page screenshot cut off?** Captures are limited to 16,383 pixels in height and 40 million pixels in total (browser and WebP limits); the item then has `truncated: true`. Pages that load content only while you scroll may also end early.

**Can I capture pages behind a login?** No. The Actor captures public pages only.

**How do I download all files?** Use each item's `screenshotUrl`, or open the run's key-value store in Apify Console.

**How much memory does it need?** The default 1 GB runs 2 pages in parallel. Each extra parallel page needs about 350 MB; the Actor lowers `maxConcurrency` to fit the run memory and logs it. Raise the memory for more speed or very large full pages.

### Developer notes

- `npm test` runs unit tests and integration tests against local HTML fixtures in real Chromium (`npx playwright install chromium` once).
- `npm run health` captures example.com and wikipedia.org live. A daily GitHub workflow runs it.
- `npm run benchmark` measures time per screenshot and peak memory locally.
- `npm run quality -- <dir> [url ...]` captures heavy live pages, prints time and blank verdict per page, and saves the files for side-by-side comparison (`QUALITY_FULL_PAGE=0` for viewport captures).
- After `load`, a capture waits at most 2.5 s for network idle (pages with beacons never go idle), then up to 3 s for web fonts and non-lazy images still loading.
- The Playwright version in `package.json` must match the Docker image tag `apify/actor-node-playwright-chrome:22-<version>`.
- Private-address guard: every browser request's host is checked; names are resolved with `dns.lookup` (all addresses, 30 s cache) and blocked if any address is private or the lookup fails. Residual risk: Chromium resolves the name again itself, so a DNS-rebinding server that answers public to the guard and private to Chromium milliseconds later is not stopped. Closing that needs a local proxy that resolves once and connects to the checked address (TODO).
- Pricing is configured in Apify Console: one pay-per-event event named `screenshot` (mirrored in `.actor/pay_per_event.json`), with Store discount tiers per plan.

# Actor input Schema

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

Web pages to capture, one per line. https:// is added when missing. Duplicates are captured once. Only capture pages you have the right to capture.

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

File format. PDF renders the page as one PDF page with backgrounds.

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

Capture the whole scrollable page instead of just the visible viewport. Very tall pages are cut at 16,383 pixels in height or 40 million pixels in total.

## `viewport` (type: `string`):

Desktop 1920x1080, Laptop 1366x768, Tablet 768x1024, Mobile 390x844 (touch, mobile layout), or Custom with the width and height below.

## `viewportWidth` (type: `integer`):

Viewport width for the Custom option.

## `viewportHeight` (type: `integer`):

Viewport height for the Custom option.

## `deviceScaleFactor` (type: `integer`):

1 = normal, 2 = Retina / high-DPI (twice the width and height in pixels), 3 = extra sharp.

## `quality` (type: `integer`):

Compression quality from 1 to 100. Ignored for PNG and PDF.

## `selector` (type: `string`):

Capture only the first element matching this CSS selector, e.g. "main" or "#pricing". Not available for PDF.

## `waitForSelector` (type: `string`):

Wait until an element matching this CSS selector is visible before capturing. If it never appears, the URL fails and is not charged.

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

Wait this long after the page has loaded, e.g. for animations.

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

CSS selectors of elements to hide before capturing, e.g. chat widgets or sticky headers.

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

Ask the page for its dark color scheme (prefers-color-scheme: dark). Only pages that support dark mode change.

## `dismissCookieBanners` (type: `boolean`):

Hide common cookie consent banners (OneTrust, Cookiebot, Quantcast, Didomi, Usercentrics and others). Best effort: banners are hidden, never clicked.

## `blockAds` (type: `boolean`):

Skip loading well-known ad networks and hide common ad slots. Best effort.

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

How long to wait for a page to load. Slow pages fail and are not charged.

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

How many pages to capture at the same time. Each parallel page needs about 350 MB, so this is lowered automatically to fit the run memory (2 pages at 1 GB, 4 at 2 GB).

## `userAgent` (type: `string`):

Leave empty to use the browser's normal Chromium User-Agent. Set your own, e.g. to identify your monitoring tool.

## Actor input object example

```json
{
  "urls": [
    "https://example.com",
    "https://www.wikipedia.org"
  ],
  "format": "png",
  "fullPage": false,
  "viewport": "desktop",
  "deviceScaleFactor": 1,
  "quality": 80,
  "delayMs": 0,
  "darkMode": false,
  "dismissCookieBanners": false,
  "blockAds": false,
  "timeoutSecs": 30,
  "maxConcurrency": 2
}
```

# Actor output Schema

## `screenshots` (type: `string`):

One item per valid screenshot, with a public link to the file, the final URL, status code, title and image size.

## `summary` (type: `string`):

Counts of captured, failed and skipped URLs, with the reason for each failure.

# 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": [
        "https://example.com",
        "https://www.wikipedia.org"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("black-vikings/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": [
        "https://example.com",
        "https://www.wikipedia.org",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("black-vikings/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": [
    "https://example.com",
    "https://www.wikipedia.org"
  ]
}' |
apify call black-vikings/website-screenshot --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,black-vikings/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/VrpNWdvh9XcJjGmLh/builds/fngUNNQGgho1T6mII/openapi.json
