# Chrome DevTools Automation Runner (`produkdigitalali/chrome-devtools-automation-runner`) Actor

Run low-level Chrome DevTools Protocol workflows in the cloud, including navigation, JavaScript evaluation, headers, cookies, device emulation, screenshots, PDFs, and raw CDP commands.

- **URL**: https://apify.com/produkdigitalali/chrome-devtools-automation-runner.md
- **Developed by:** [ProdukDigitalAli](https://apify.com/produkdigitalali) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 results

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/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

### What is Chrome DevTools Automation Runner?

Chrome DevTools Automation Runner executes low-level browser workflows directly through the Chrome DevTools Protocol (CDP) in the Apify cloud.

Instead of relying on a high-level browser automation framework for every operation, the Actor opens headless Chrome with a DevTools endpoint and sends CDP commands directly. Each configured step is written as one structured Dataset result.

This is useful for developer automation, browser diagnostics, rendering workflows, device emulation, JavaScript evaluation, screenshots, PDF generation, and advanced CDP experiments.

### Supported actions

- `navigate` - open a public HTTP(S) URL using `Page.navigate`
- `wait` - pause for a fixed number of milliseconds
- `evaluate` - evaluate JavaScript in the page through `Runtime.evaluate`
- `getHtml` - return the current document HTML
- `getTitle` - return the current document title
- `getText` - return text content from a CSS selector
- `setExtraHTTPHeaders` - set request headers through the Network domain
- `setCookies` - set browser cookies through the Network domain
- `setUserAgent` - override the browser user agent
- `emulateViewport` - change viewport dimensions, device scale factor, and mobile mode
- `screenshot` - capture a PNG using `Page.captureScreenshot`
- `printPdf` - render the current page to PDF using `Page.printToPDF`
- `rawCommand` - send an advanced CDP method with JSON parameters

For isolation and request safety, raw `Fetch.*`, `Target.*`, and `Browser.*` methods are blocked.

### Example input

```json
{
  "targetUrl": "https://example.com",
  "workflowName": "Example.com CDP workflow",
  "actions": [
    {
      "type": "navigate",
      "label": "Open target page"
    },
    {
      "type": "getTitle",
      "label": "Read page title"
    },
    {
      "type": "getText",
      "label": "Read H1 text",
      "selector": "h1"
    },
    {
      "type": "evaluate",
      "label": "Read viewport",
      "expression": "({ width: innerWidth, height: innerHeight })"
    },
    {
      "type": "screenshot",
      "label": "Capture page"
    }
  ]
}
```

### Example output

Each executed action is written to the default Dataset:

```json
{
  "workflowName": "Example.com CDP workflow",
  "targetUrl": "https://example.com",
  "step": 3,
  "action": "getText",
  "label": "Read H1 text",
  "passed": true,
  "currentUrl": "https://example.com/",
  "value": "Example Domain",
  "error": null,
  "artifactUrl": null,
  "artifactType": null
}
```

Screenshot and PDF actions return public Key-Value Store artifact URLs.

### Advanced raw CDP commands

Use `rawCommand` when you need a CDP method that does not have a dedicated action yet.

Example:

```json
{
  "type": "rawCommand",
  "label": "Read heap usage",
  "method": "Runtime.getHeapUsage",
  "params": {}
}
```

The command result is serialized into the `value` field.

Some methods are intentionally blocked because they could disable the Actor's network safety controls or escape the page-level execution model.

### Screenshots and PDF generation

`screenshot` stores a PNG in the default Key-Value Store. Full-page screenshots are enabled by default and use page layout metrics when available.

`printPdf` stores a PDF in the same Key-Value Store and can optionally render in landscape mode.

### Public-network safety

The Actor is intended for public websites only.

It rejects target URLs that resolve to localhost, loopback, link-local, private RFC1918 ranges, and several common non-public address ranges. Chrome requests are intercepted through the CDP Fetch domain and private-network requests are blocked during the run.

This protection is best-effort and is designed to reduce accidental or malicious SSRF-style access from a public Actor.

### Use cases

#### Low-level browser automation

Run browser operations close to Chrome itself without maintaining your own DevTools websocket infrastructure.

#### Browser diagnostics

Evaluate page state, inspect rendered HTML, change headers, and run selected diagnostic CDP commands.

#### Rendering and document generation

Generate screenshots and PDFs from JavaScript-rendered pages.

#### Device and viewport emulation

Change viewport dimensions, device pixel ratio, mobile behavior, or use advanced Emulation domain commands through `rawCommand`.

#### Scheduled developer workflows

Run CDP tasks on an Apify schedule and consume step results through the Dataset API.

#### AI and backend tooling

Expose low-level Chrome capabilities as a reusable cloud component for developer tools, backend services, or agent workflows.

### Important limitations

- This Actor intentionally exposes advanced browser capabilities and is aimed at technical users.
- Arbitrary JavaScript evaluation can modify the currently loaded public page.
- Dynamic sites can change behavior or block headless browsers.
- CDP methods can differ between Chrome versions.
- Large `getHtml` or raw command results can produce large Dataset values.
- Private and local network access is not supported.

### Responsible use

Only automate websites and systems you are authorized to access. Follow applicable laws, privacy requirements, website terms, and rate limits.

This Actor is an independent developer tool. It is not affiliated with or endorsed by Google or the Chrome DevTools team.

### Support

When reporting an issue, include:

- the public target URL
- a sanitized input example
- the failing step number
- the CDP method, if using `rawCommand`
- the error stored in the Dataset

Do not post passwords, API keys, private cookies, or other secrets in public issues.

# Actor input Schema

## `targetUrl` (type: `string`):

Public HTTP(S) URL used by navigate actions that do not specify their own URL.

## `workflowName` (type: `string`):

Human-readable name included in every result row and the run summary.

## `actions` (type: `array`):

Ordered low-level Chrome actions. Fill only the fields required by each selected action type.

## `navigationTimeoutSeconds` (type: `integer`):

Default timeout for page navigation and load events, in seconds.

## `actionTimeoutSeconds` (type: `integer`):

Default timeout for CDP action event waits, in seconds.

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

Initial Chrome viewport width in pixels.

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

Initial Chrome viewport height in pixels.

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

Initial device pixel ratio used by Chrome emulation.

## `mobile` (type: `boolean`):

Start Chrome with mobile viewport behavior enabled.

## `stopOnError` (type: `boolean`):

Stop the workflow after the first failed step. Disable to record later steps when they can still run.

## Actor input object example

```json
{
  "targetUrl": "https://example.com",
  "workflowName": "Example.com CDP workflow",
  "actions": [
    {
      "type": "navigate",
      "label": "Open target page"
    },
    {
      "type": "getTitle",
      "label": "Read page title"
    },
    {
      "type": "getText",
      "label": "Read H1 text",
      "selector": "h1"
    },
    {
      "type": "screenshot",
      "label": "Capture page"
    }
  ],
  "navigationTimeoutSeconds": 30,
  "actionTimeoutSeconds": 15,
  "viewportWidth": 1365,
  "viewportHeight": 768,
  "deviceScaleFactor": 1,
  "mobile": false,
  "stopOnError": true
}
```

# Actor output Schema

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

No description

## `summary` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("produkdigitalali/chrome-devtools-automation-runner").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("produkdigitalali/chrome-devtools-automation-runner").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 '{}' |
apify call produkdigitalali/chrome-devtools-automation-runner --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,produkdigitalali/chrome-devtools-automation-runner"
        }
    }
}

```

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/eVwEMLB2RryW9j3S3/builds/tRAVwuegblomvT2Ds/openapi.json
