# Website Screenshot Capture — Full Page & Custom Viewport (`wsgcjj/screenshot-capture`) Actor

Takes a list of URLs and captures screenshots of each page using Playwright (headless Chromium). Supports viewport size, full-page capture, and PNG/JPEG formats. Ideal for website monitoring, content archiving, and competitive analysis.

- **URL**: https://apify.com/wsgcjj/screenshot-capture.md
- **Developed by:** [陈俊杰](https://apify.com/wsgcjj) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Screenshot Capture

[![apify](https://img.shields.io/badge/Apify-Actor-blue)](https://apify.com)

An Apify Actor that captures **full-page or viewport-sized screenshots** of websites using **Playwright** (headless Chromium). Input a list of URLs, get high-quality PNG or JPEG screenshots stored in the Actor's key-value store.

### 🎯 Use Cases

- **Website Monitoring** — Capture visual snapshots of your sites over time
- **Content Archiving** — Archive web pages as images for offline records
- **Competitive Analysis** — Screenshot competitor landing pages and products
- **UI/Visual Regression** — Baseline screenshots for later comparison
- **SEO Audits** — Verify how pages render across viewport sizes

### 📥 Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `urls` | `array[string]` | — | **Required.** List of URLs to capture. |
| `width` | `integer` | `1280` | Viewport width in pixels (max 3840). |
| `height` | `integer` | `720` | Viewport height in pixels (max 2160). |
| `full_page` | `boolean` | `false` | Capture the entire page, including below-the-fold content. |
| `format` | `string` | `"png"` | Image format — `"png"` or `"jpeg"`. |

#### Example Input

```json
{
  "urls": ["https://example.com", "https://httpbin.org"],
  "width": 1920,
  "height": 1080,
  "full_page": true,
  "format": "png"
}
````

### 📤 Output

Each captured URL produces a result record pushed via `Actor.push_data()`:

| Field | Type | Description |
|-------|------|-------------|
| `url` | `string` | The original URL. |
| `screenshot_key` | `string\|null` | Key in key-value store (null if failed). |
| `width` | `integer` | Viewport width used. |
| `height` | `integer` | Viewport height used. |
| `full_page` | `boolean` | Whether full-page capture was enabled. |
| `format` | `string` | Image format. |
| `captured_at` | `string` | ISO-8601 timestamp. |
| `status_code` | `integer` | HTTP response status code. |
| `elapsed_secs` | `number` | Time taken to capture. |
| `error` | `string\|null` | Error message if capture failed. |

Screenshots are stored in the [Key-value store](https://docs.apify.com/platform/storage/key-value-store) under the key `screenshot-{sanitized-url}-{timestamp}.{format}`.

### ⚙️ Technical Details

- **Engine:** Playwright (headless Chromium) via Crawlee
- **Navigation:** `networkidle` wait strategy + 2s settle delay
- **Retries:** Up to 3 retries with exponential backoff
- **Timeout:** 45s navigation, 60s total per request
- **Browser args:** `--no-sandbox`, `--disable-setuid-sandbox`, `--disable-dev-shm-usage`, `--disable-gpu`

### 🔧 Development

#### Prerequisites

- Python 3.14+
- [Apify CLI](https://docs.apify.com/cli)

#### Local Run

```bash
## Install dependencies
pip install -r requirements.txt

## Install Playwright browsers
playwright install chromium

## Run the actor
python -m src
```

#### Local Development with Apify CLI

```bash
apify run
```

#### Project Structure

```
screenshot-capture/
├── .actor/
│   ├── actor.json            ## Actor definition
│   ├── input_schema.json     ## JSON Schema for input
│   ├── output_schema.json    ## JSON Schema for output
│   └── pay_per_event.json    ## Pricing configuration
├── src/
│   ├── __init__.py           ## Package init
│   ├── __main__.py           ## Entry point
│   └── main.py               ## Core logic
├── Dockerfile                ## apify/actor-python:3.14
├── requirements.txt          ## Python dependencies
├── .dockerignore
├── .gitignore
└── README.md
```

### 💰 Pricing

- **$0.01 per screenshot** captured
- Default included: 100 screenshots

### 📝 License

MIT

# Actor input Schema

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

List of website URLs to capture screenshots of.

## `width` (type: `integer`):

Browser viewport width in pixels.

## `height` (type: `integer`):

Browser viewport height in pixels.

## `full_page` (type: `boolean`):

Capture the entire page, including content below the fold.

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

Output image format.

## Actor input object example

```json
{
  "urls": [
    "https://example.com"
  ],
  "width": 1280,
  "height": 720,
  "full_page": false,
  "format": "png"
}
```

# Actor output Schema

## `url` (type: `string`):

The original URL that was captured.

## `screenshot_key` (type: `string`):

Key of the screenshot in the key-value store. Null if capture failed.

## `width` (type: `string`):

Viewport width used for the capture.

## `height` (type: `string`):

Viewport height used for the capture.

## `full_page` (type: `string`):

Whether the screenshot is a full-page capture.

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

Image format of the saved screenshot.

## `captured_at` (type: `string`):

ISO-8601 timestamp when the screenshot was captured.

## `status_code` (type: `string`):

HTTP response status code from the page load.

## `elapsed_secs` (type: `string`):

Time taken to capture the screenshot in seconds.

## `error` (type: `string`):

Error message if the capture failed, otherwise null.

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("wsgcjj/screenshot-capture").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"] }

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

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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"
  ]
}' |
apify call wsgcjj/screenshot-capture --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=wsgcjj/screenshot-capture",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Website Screenshot Capture — Full Page & Custom Viewport",
        "description": "Takes a list of URLs and captures screenshots of each page using Playwright (headless Chromium). Supports viewport size, full-page capture, and PNG/JPEG formats. Ideal for website monitoring, content archiving, and competitive analysis.",
        "version": "0.0",
        "x-build-id": "qUkcC89RtqOmvOm3g"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/wsgcjj~screenshot-capture/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-wsgcjj-screenshot-capture",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/wsgcjj~screenshot-capture/runs": {
            "post": {
                "operationId": "runs-sync-wsgcjj-screenshot-capture",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/wsgcjj~screenshot-capture/run-sync": {
            "post": {
                "operationId": "run-sync-wsgcjj-screenshot-capture",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "URLs",
                        "type": "array",
                        "description": "List of website URLs to capture screenshots of.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "width": {
                        "title": "Viewport Width",
                        "type": "integer",
                        "description": "Browser viewport width in pixels.",
                        "default": 1280
                    },
                    "height": {
                        "title": "Viewport Height",
                        "type": "integer",
                        "description": "Browser viewport height in pixels.",
                        "default": 720
                    },
                    "full_page": {
                        "title": "Full Page Screenshot",
                        "type": "boolean",
                        "description": "Capture the entire page, including content below the fold.",
                        "default": false
                    },
                    "format": {
                        "title": "Image Format",
                        "type": "string",
                        "description": "Output image format.",
                        "default": "png"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
