# Browser as a Service (BaaS) (`zenacquire/browser-as-a-service`) Actor

Declarative browser automation. Send JSON actions — navigate, click, type, scrape, screenshot — get clean structured results. No code required. Powered by Playwright.

- **URL**: https://apify.com/zenacquire/browser-as-a-service.md
- **Developed by:** [Aaron](https://apify.com/zenacquire) (community)
- **Categories:** AI, Developer tools, Automation
- **Stats:** 25 total users, 6 monthly users, 97.6% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $25.00 / 1,000 screenshot or page elements

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

## 🌐 Browser as a Service (BaaS)

**Automate any website with simple JSON. No code required.**

Tell it what page to visit and what to do — click buttons, fill forms, grab text, take screenshots. It runs a real browser in the cloud and gives you back clean data.

***

### ⚡ How it works (3 steps)

#### 1️⃣ Get your Apify API token

Go to [apify.com](https://apify.com) → create a free account → **Settings > Integrations** → copy your API token.

#### 2️⃣ Tell it what to do

Send a JSON message with two things:

- `url` — the page you want to visit
- `actions` — a list of steps to perform (in order)

#### 3️⃣ Get your data

Results come back as clean JSON — text, data, screenshot links, whatever you asked for. Each scraped item shows up as a row in the output table.

***

### 🤖 Use with AI — Just Copy & Paste

Don't know how to code? No problem. Just paste one of these prompts into your favorite AI and tell it what you want. It does the rest.

#### 💬 Prompt for Claude / Claude Code

> Copy this whole block, paste it into Claude, and replace the two things in \[brackets]:

```
I want to use the Apify actor "zenacquire/browser-as-a-service" to automate a browser task.

My Apify API token: [PASTE YOUR TOKEN HERE]

How the actor works:
- API: POST https://api.apify.com/v2/acts/zenacquire~browser-as-a-service/runs?token=YOUR_TOKEN
- Send JSON with "url" (the page) and "actions" (ordered list of browser steps)
- Actions available:
  → navigate — open a page
  → click — click a button or link (needs "selector")
  → type — fill in a text field (needs "selector" and "value")
  → scrape — grab text from the page (needs "selector" and "name")
  → screenshot — take a picture of the page ("fullPage": true for whole page)
  → wait — pause until something loads (needs "selector" or "ms")
  → select — pick from a dropdown (needs "selector" and "value")
  → hover — mouse over an element (needs "selector")
  → scroll — scroll the page (needs "y" for pixels or "selector" to scroll to)
  → evaluate — run custom JavaScript on the page (needs "expression")

Each scraped item comes back as { url, action, value } in the dataset.
Screenshots are saved in the key-value store.

Get results: GET https://api.apify.com/v2/actor-runs/{RUN_ID}/dataset/items?token=YOUR_TOKEN
Get screenshots: GET https://api.apify.com/v2/actor-runs/{RUN_ID}/key-value-store/records/{NAME}?token=YOUR_TOKEN

Here's what I want to do: [DESCRIBE YOUR TASK IN PLAIN ENGLISH]
```

**Example things you can say:**

- "Scrape all product names and prices from this Amazon search page: https://amazon.com/s?k=wireless+earbuds"
- "Go to Zillow, search for homes in Austin TX, and grab the first page of listings"
- "Take a screenshot of my website https://mysite.com"
- "Fill out the contact form on https://example.com/contact with my info"

***

#### 💬 Prompt for ChatGPT

> Same idea — copy, paste, fill in the blanks:

```
Help me use the Apify actor "zenacquire/browser-as-a-service" to automate a browser task.

My Apify token: [PASTE YOUR TOKEN HERE]

API: POST https://api.apify.com/v2/acts/zenacquire~browser-as-a-service/runs?token=YOUR_TOKEN
Content-Type: application/json
Body: { "url": "...", "actions": [...] }

Actions:
→ navigate (open page)
→ click (selector)
→ type (selector + value)
→ scrape (selector + name) — extracts text
→ screenshot (name, fullPage)
→ wait (selector or ms)
→ select (selector + value)
→ hover (selector)
→ scroll (selector or y pixels)
→ evaluate (expression — runs JavaScript)

Results: GET https://api.apify.com/v2/actor-runs/{RUN_ID}/dataset/items?token=YOUR_TOKEN
Each result = { url, action, value }

What I need: [DESCRIBE YOUR TASK IN PLAIN ENGLISH]
```

***

### 📋 Real-World Examples

#### 🛒 Grab an Amazon product title and price

```json
{
    "url": "https://www.amazon.com/dp/B0DXXXXXXXXX",
    "actions": [
        { "type": "navigate" },
        { "type": "scrape", "selector": "#productTitle", "name": "title" },
        { "type": "scrape", "selector": ".a-price .a-offscreen", "name": "price" },
        { "type": "screenshot", "name": "product-page", "fullPage": true }
    ]
}
```

**Output:**
| URL | Action | Value |
|-----|--------|-------|
| amazon.com/dp/... | title | Sony WH-1000XM5 Wireless Headphones |
| amazon.com/dp/... | price | $278.00 |

***

#### 📰 Scrape Hacker News headlines

```json
{
    "url": "https://news.ycombinator.com/",
    "actions": [
        { "type": "navigate" },
        { "type": "scrape", "selector": ".titleline > a", "name": "headlines" }
    ]
}
```

***

#### 🔍 Search Google and grab results

```json
{
    "url": "https://www.google.com/",
    "actions": [
        { "type": "navigate" },
        { "type": "type", "selector": "textarea[name=q]", "value": "best headphones 2026" },
        { "type": "click", "selector": "input[name=btnK]" },
        { "type": "wait", "selector": "#search" },
        { "type": "scrape", "selector": "h3", "name": "results" },
        { "type": "screenshot", "name": "search-results", "fullPage": true }
    ]
}
```

***

#### 📸 Screenshot any website

```json
{
    "url": "https://example.com/",
    "actions": [
        { "type": "navigate" },
        { "type": "screenshot", "name": "full-page", "fullPage": true }
    ]
}
```

***

### 🧪 Quick Test (cURL)

Copy-paste into your terminal to test it right now:

```bash
curl -X POST "https://api.apify.com/v2/acts/zenacquire~browser-as-a-service/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://news.ycombinator.com/",
    "actions": [
      { "type": "navigate" },
      { "type": "scrape", "selector": ".titleline > a", "name": "headlines" },
      { "type": "screenshot", "name": "hn", "fullPage": true }
    ]
  }'
```

***

### 🐍 Python

```python
import requests, time

TOKEN = "YOUR_APIFY_TOKEN"
BASE = "https://api.apify.com/v2"

## Start the run
run = requests.post(
    f"{BASE}/acts/zenacquire~browser-as-a-service/runs?token={TOKEN}",
    json={
        "url": "https://example.com/",
        "actions": [
            {"type": "navigate"},
            {"type": "scrape", "selector": "h1", "name": "heading"},
            {"type": "screenshot", "name": "page", "fullPage": True}
        ]
    }
).json()

run_id = run["data"]["id"]
print(f"🚀 Run started: {run_id}")

## Wait for it to finish
while True:
    status = requests.get(f"{BASE}/actor-runs/{run_id}?token={TOKEN}").json()
    state = status["data"]["status"]
    if state in ("SUCCEEDED", "FAILED", "ABORTED", "TIMED-OUT"):
        break
    time.sleep(2)

## Get results
items = requests.get(f"{BASE}/actor-runs/{run_id}/dataset/items?token={TOKEN}").json()
for item in items:
    print(f"  {item['action']}: {item['value']}")
```

***

### 📦 JavaScript / Node.js

```javascript
const TOKEN = "YOUR_APIFY_TOKEN";
const BASE = "https://api.apify.com/v2";

const run = await fetch(
  `${BASE}/acts/zenacquire~browser-as-a-service/runs?token=${TOKEN}`,
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      url: "https://example.com/",
      actions: [
        { type: "navigate" },
        { type: "scrape", selector: "h1", name: "heading" },
        { type: "screenshot", name: "page", fullPage: true },
      ],
    }),
  }
).then((r) => r.json());

const runId = run.data.id;
console.log(`🚀 Run started: ${runId}`);

// Wait for it to finish
let state;
do {
  await new Promise((r) => setTimeout(r, 2000));
  const status = await fetch(`${BASE}/actor-runs/${runId}?token=${TOKEN}`).then((r) => r.json());
  state = status.data.status;
} while (!["SUCCEEDED", "FAILED", "ABORTED", "TIMED-OUT"].includes(state));

// Get results
const items = await fetch(`${BASE}/actor-runs/${runId}/dataset/items?token=${TOKEN}`).then((r) => r.json());
items.forEach((item) => console.log(`  ${item.action}: ${item.value}`));
```

***

### 🎯 All Actions

| What you want to do | Action | What to include |
|---------------------|--------|-----------------|
| 🌐 Open a page | `navigate` | `url` (optional — defaults to input url) |
| 👆 Click something | `click` | `selector` |
| ⌨️ Type into a field | `type` | `selector` + `value` |
| 📋 Grab text from page | `scrape` | `selector` + `name` |
| 📸 Take a screenshot | `screenshot` | `name` + `fullPage` (true/false) |
| ⏳ Wait for something | `wait` | `selector` or `ms` (milliseconds) |
| 📑 Pick from dropdown | `select` | `selector` + `value` |
| 🖱️ Hover over element | `hover` | `selector` |
| 📜 Scroll the page | `scroll` | `selector` or `y` (pixels) |
| 💻 Run JavaScript | `evaluate` | `expression` + `name` |

> 💡 **What's a selector?** It's how you point to something on a page. In Chrome: right-click any element → **Inspect** → right-click the highlighted code → **Copy** → **Copy selector**. Paste that into the `selector` field.

***

### ⚙️ Options

| Setting | Default | What it does |
|---------|---------|--------------|
| `browserType` | `"chromium"` | Browser engine: `chromium`, `firefox`, or `webkit` |
| `timeoutSecs` | `30` | Max seconds to wait per action |
| `viewport` | `{"width": 1280, "height": 720}` | Browser window size |
| `proxyConfiguration` | none | Use Apify proxy to avoid blocks |

***

### 💰 Pricing

| Event | Cost |
|-------|------|
| Per scraped result | $7.00 / 1,000 |
| Per screenshot | $25.00 / 1,000 |
| Actor start | $0.00005 |
| Platform usage | Variable (cheaper on higher Apify plans) |

# Actor input Schema

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

The starting URL to navigate to.

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

Ordered list of browser actions to execute. Each action has a `type` (navigate, click, type, scrape, screenshot, wait, select, hover, scroll, evaluate) and type-specific fields.

## `browserType` (type: `string`):

Which browser engine to use.

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

Max time in seconds to wait for each individual action to complete.

## `waitForNavigationSecs` (type: `integer`):

Max time in seconds to wait for page navigation / load.

## `proxyConfiguration` (type: `object`):

Apify proxy or custom proxy configuration.

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

Override the default browser user agent string.

## `viewport` (type: `object`):

Browser viewport dimensions. Defaults to 1280x720.

## Actor input object example

```json
{
  "url": "https://example.com/",
  "actions": [
    {
      "type": "navigate"
    },
    {
      "type": "scrape",
      "selector": "h1",
      "name": "heading"
    },
    {
      "type": "screenshot",
      "name": "result",
      "fullPage": true
    }
  ],
  "browserType": "chromium",
  "timeoutSecs": 30,
  "waitForNavigationSecs": 30,
  "viewport": {
    "width": 1280,
    "height": 720
  }
}
```

# 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 = {
    "url": "https://example.com/",
    "actions": [
        {
            "type": "navigate"
        },
        {
            "type": "scrape",
            "selector": "h1",
            "name": "heading"
        },
        {
            "type": "screenshot",
            "name": "result",
            "fullPage": true
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("zenacquire/browser-as-a-service").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 = {
    "url": "https://example.com/",
    "actions": [
        { "type": "navigate" },
        {
            "type": "scrape",
            "selector": "h1",
            "name": "heading",
        },
        {
            "type": "screenshot",
            "name": "result",
            "fullPage": True,
        },
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("zenacquire/browser-as-a-service").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 '{
  "url": "https://example.com/",
  "actions": [
    {
      "type": "navigate"
    },
    {
      "type": "scrape",
      "selector": "h1",
      "name": "heading"
    },
    {
      "type": "screenshot",
      "name": "result",
      "fullPage": true
    }
  ]
}' |
apify call zenacquire/browser-as-a-service --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zenacquire/browser-as-a-service"
        }
    }
}

```

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/LJIlfmlVv08DFswME/builds/GryAlYv0JaaEHnLGm/openapi.json
