# Screenshot Saver (`codingfrontend/screenshot-saver`) Actor

Capture screenshots of websites and save to cloud storage. Supports multiple URLs, full page capture, custom viewports, and various output destinations.

- **URL**: https://apify.com/codingfrontend/screenshot-saver.md
- **Developed by:** [Coding Frontned](https://apify.com/codingfrontend) (community)
- **Categories:** Automation, Developer tools, Other
- **Stats:** 11 total users, 1 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Saver

Capture public or authorized web pages as PNG, JPEG, or PDF artifacts. The Actor uses an ordinary headless Chrome session, supports multiple URLs, full-page or element capture, custom viewports and mobile presets, waits, cookies, headers, basic auth, resource blocking, CSS/JavaScript injection, and optional click or hide selectors.

### Example input

```json
{
  "urls": [{"url": "https://example.com/"}],
  "format": "png",
  "fullPage": true,
  "windowWidth": 1440,
  "windowHeight": 900,
  "waitUntil": "networkidle2"
}
```

The `urls` array is required and accepts at most 100 distinct public HTTP(S) URLs per run. Exact duplicates are removed while preserving input order. Localhost, private/link-local/reserved IP ranges, embedded URL credentials, and non-HTTP protocols are rejected before Chrome starts. Use `captureSelector` to capture one PNG/JPEG element, or `mobileEmulation` to use a device preset. PDF output captures a page document and cannot be combined with `captureSelector`.

### Example output

Dataset metadata points to the binary artifact in the key-value store:

```json
{
  "timestamp": "2026-08-17T00:00:00.000Z",
  "recordType": "screenshot",
  "found": true,
  "dataAvailable": true,
  "startUrl": "https://example.com/",
  "url": "https://example.com/",
  "screenshotUrl": "https://api.apify.com/v2/key-value-stores/STORE/records/screenshot_example",
  "screenshotKey": "screenshot_example",
  "format": "png",
  "contentType": "image/png",
  "artifactSizeBytes": 18452,
  "captureMode": "page",
  "statusCode": 200,
  "pageTitle": "Example Domain",
  "error": false
}
```

### Storage

- Binary PNG, JPEG, or PDF artifacts are stored under individual keys in the default key-value store.
- Metadata rows are written to the default dataset.
- Successful rows use `recordType: screenshot`, `found: true`, and `dataAvailable: true`; failed-request artifacts are explicit diagnostics and never count as successful captures.
- The OUTPUT key-value store record contains recordType runSummary on completion or runDiagnostic on failure.
- Failed navigation requests may still produce a fallback PNG screenshot with error true.

### Limits and cost

- URLs are processed sequentially with one crawler worker.
- Navigation can wait up to 120 seconds and request handling up to 180 seconds.
- Large full-page screenshots and PDFs consume more memory and storage than viewport PNGs.
- Apify browser compute, key-value storage, and dataset charges, if applicable to the selected account plan, depend on URL count and artifact size.

### FAQ

#### Does it upload artifacts to an external cloud provider?

No. Screenshot and PDF binaries are stored in the Actor's default Apify key-value store, and their public record URLs are included in dataset rows.

#### Can I capture authenticated pages?

Only when you are authorized. The input supports HTTP basic auth, cookies, and headers; do not submit credentials or session tokens for pages you do not control.

#### What happens if navigation fails?

The crawler may preserve a fallback PNG as a diagnostic row with `recordType: diagnostic`, `found: false`, `dataAvailable: false`, and `error: true`. A run with no successful captures fails so downstream automation cannot mistake an error page for a valid screenshot.

### Disclaimer

Use this Actor only for public pages or pages you are authorized to access. Treat injected JavaScript, cookies, headers, and credentials as sensitive. The Actor does not bypass authentication, CAPTCHAs, access controls, or rate limits.

# Actor input Schema

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

List of URLs to capture screenshots of.

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

Screenshot format. PNG is lossless, JPEG is smaller, PDF renders the whole page as a document.

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

Capture the entire scrollable page height, not just the visible viewport.

## `windowWidth` (type: `integer`):

Browser window width in pixels. Use 375 for mobile, 768 for tablet, 1920 for desktop.

## `windowHeight` (type: `integer`):

Browser window height in pixels.

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

JPEG compression quality (1–100). Lower = smaller file size. Only applies when format is 'jpeg'.

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

When to consider the page fully loaded before taking the screenshot.

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

CSS selector to wait for before taking the screenshot. Useful for dynamic pages. Example: '#main-content' or '.product-list'

## `waitForTimeout` (type: `integer`):

Additional time to wait (in milliseconds) after the page loads before taking the screenshot. Useful for animations or lazy-loading content.

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

Slowly scroll to the bottom of the page before taking the screenshot, triggering lazy-loaded images and content.

## `clickSelector` (type: `string`):

CSS selector of an element to click before taking the screenshot. Useful for closing cookie banners, opening menus, or dismissing popups. Example: '.cookie-accept', '#close-popup'

## `selectorsToHide` (type: `string`):

Comma-separated CSS selectors of elements to hide before taking the screenshot. Example: '.cookie-banner, .ads, .newsletter-popup'

## `injectCss` (type: `string`):

Custom CSS to inject into the page before taking the screenshot. Example: 'body { background: white; } .banner { display: none; }'

## `injectJs` (type: `string`):

Custom JavaScript to execute on the page before taking the screenshot. Example: 'document.querySelector(".sidebar").remove();'

## `captureSelector` (type: `string`):

CSS selector of a specific element to screenshot instead of the whole page. Example: '#product-card' or '.data-table'. Overrides fullPage setting.

## `mobileEmulation` (type: `string`):

Emulate a specific mobile device. Overrides windowWidth/windowHeight settings.

## `deviceScaleFactor` (type: `number`):

Device pixel ratio for retina/HiDPI screenshots. Use 1 for standard, 2 for retina quality.

## `blockResources` (type: `array`):

Block specific resource types to speed up page loading. Useful for getting a text-only or CSS-only view.

## `username` (type: `string`):

Username for HTTP Basic Authentication (for password-protected pages).

## `password` (type: `string`):

Password for HTTP Basic Authentication.

## `cookies` (type: `array`):

Authorized cookies to set before initial navigation. Example: \[{"name": "session", "value": "abc123", "domain": ".example.com"}]

## `headers` (type: `object`):

Additional HTTP headers to send with every request. Example: {"Authorization": "Bearer token123", "X-Custom": "value"}

## Actor input object example

```json
{
  "urls": [
    {
      "url": "https://example.com/"
    }
  ],
  "format": "png",
  "fullPage": true,
  "windowWidth": 1920,
  "windowHeight": 1080,
  "quality": 80,
  "waitUntil": "networkidle2",
  "waitForTimeout": 0,
  "scrollToBottom": true,
  "mobileEmulation": "",
  "deviceScaleFactor": 1,
  "blockResources": []
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `runSummary` (type: `string`):

No description

# 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://example.com/"
        }
    ]
};

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

# Run the Actor and wait for it to finish
run = client.actor("codingfrontend/screenshot-saver").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://example.com/"
    }
  ]
}' |
apify call codingfrontend/screenshot-saver --silent --output-dataset

```

## MCP server setup

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

```

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/K68P7FoYs3Q94EjLx/builds/xJ8e5nG3ugSmIMjpE/openapi.json
