Cdp Browser
CDP browser control at localhost:9222.
- Rating
- 4.2 (393 reviews)
- Downloads
- 49,277 downloads
- Version
- 1.0.0
Overview
CDP browser control at localhost:9222.
Complete Documentation
View Source →
cdp-browser
CLI for Chrome/Chromium at localhost:9222. Inspect tabs, take screenshots, navigate, scroll, post to X, or run JS in a persistent browser session.
Repo: https://github.com/gostlightai/cdp-browser
Prerequisites: Chromium running with --remote-debugging-port=9222. Docker Compose or a local Chrome with remote debugging enabled.
Commands
Run from the skill dir (bin/ scripts):
| Command | Description | ||
|---|---|---|---|
| status | List all tabs (JSON from CDP) | ||
| tabs | Same as status | ||
| new | Open new tab | ||
| goto | Navigate tab to URL | ||
| snapshot | Full-page screenshot (PNG) | ||
| close-popup | Dismiss dialogs/modals | ||
scroll | |||
| query | Return current page URL | ||
| query | Return element text (or body) | ||
| query | Return element HTML (or body) | ||
| tweet-draft | Fill compose box only; does NOT post | ||
| tweet-post | Post tweet (requires --confirm as second arg) | ||
| tweet | Alias for tweet-draft (fills compose only) |
Tweet flow
- tweet-draft (default): Fills the compose box; user reviews in browser and posts manually.
- tweet-post: Requires
--confirmas second arg (strict). Use when user explicitly approves ("go ahead", "post it", or Telegram confirm button). - Optional Telegram confirm: When
tweet.confirmButtonis enabled in config, the agent can runtweet-draft --save-pendingto write pending state, then send a message with an inline "Confirm Post" button. On confirm, the agent runstweet-post --confirm.
Config (required for Telegram confirm button)
The Telegram "Confirm Post" button only works if config exists. Copy the example and place it in your workspace:
# From the skill dir (e.g. ~/.openclaw/workspace/skills/cdp-browser):
cp .cdp-browser.json.example ~/.openclaw/workspace/.cdp-browser.json
Location: ~/.openclaw/workspace/.cdp-browser.json (or $OPENCLAW_WORKSPACE/.cdp-browser.json)
| Key | Default | Description |
|---|---|---|
| tweet.confirmButton | false | When true, agent sends draft with inline "Confirm Post" button in Telegram. User clicks to approve or says "go ahead". |
Telegram confirm button (agent instructions)
When tweet.confirmButton is true (config present) and you are in a Telegram session:
- Draft: Run
tweet-draft --save-pendingfrom the skill dir. This fills the compose box and writes"text" ~/.openclaw/workspace/.cdp-browser/pending-tweet.json. - Send with button: Run from the skill dir:
./scripts/send-tweet-confirm.sh <chat_id> "<tweet_text>"
openclaw message send directly with --buttons '[[{"text":"Confirm Post","callback_data":"cdp:tweet:confirm"}]]'. Use the current session's reply target as .
- On confirm: When the user clicks the button, OpenClaw delivers
callback_data: cdp:tweet:confirm. Or the user says "go ahead"/"post it". Treat either as approval. Then: - Read
~/.openclaw/workspace/.cdp-browser/pending-tweet.jsonfortextandtabId - Run
tweet-post--confirm " " - Edit or delete the message with the button (optional)
- Delete the pending file
Scripts
- cdp.js — Fetch-only wrapper for CDP HTTP API (
/json,/json/list,/json/new); no shell. - pw.js — Playwright connect to browser; runs snapshot/goto/scroll/query/tweet-draft/tweet-post. Compose launcher: SideNav_NewTweet_Button, /compose/post, Post only (avoids reply buttons). Post button: tweetButton, tweetButtonInline.
Security
See SECURITY.md for mitigations and operational notes.
Installation
openclaw install cdp-browser
💻Code Examples
cp .cdp-browser.json.example ~/.openclaw/workspace/.cdp-browser.json
**Location:** `~/.openclaw/workspace/.cdp-browser.json` (or `$OPENCLAW_WORKSPACE/.cdp-browser.json`)
| Key | Default | Description |
|-----|---------|-------------|
| `tweet.confirmButton` | `false` | When `true`, agent sends draft with inline "Confirm Post" button in Telegram. User clicks to approve or says "go ahead". |
Without this config, the agent uses plain tweet-draft (no button); user confirms via text only.
### Telegram confirm button (agent instructions)
When `tweet.confirmButton` is true (config present) and you are in a Telegram session:
1. **Draft:** Run `tweet-draft --save-pending <tabId> "text"` from the skill dir. This fills the compose box and writes `~/.openclaw/workspace/.cdp-browser/pending-tweet.json`.
2. **Send with button:** Run from the skill dir:Tags
Quick Info
Ready to Install?
Get started with this skill in seconds
Related Skills
4claw
4claw — a moderated imageboard for AI agents.
Aap Passport
Agent Attestation Protocol - The Reverse Turing Test.
Adaptive Suite
A continuously adaptive skill suite that empowers Clawdbot.
Adversarial Prompting
Adversarial analysis to critique, fix.