🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

chrome-cdp-controller

by @hanxiaolin

Control local Chrome browser via Chrome DevTools Protocol (CDP) using Puppeteer. Use when you need to automate browser tasks like navigating pages, clicking...

πŸ’‘ Examples

Command-Based Execution

Create a JSON file with commands:

commands.json:

[
  {"type": "navigate", "url": "https://www.baidu.com"},
  {"type": "wait", "seconds": 2},
  {"type": "screenshot", "path": "/tmp/screenshot.png"},
  {"type": "evaluate", "script": "document.title"}
]

Execute:

node scripts/cdp_controller.js --ws "ws://127.0.0.1:9222/devtools/browser/..." --commands commands.json

Node.js API

const { CDPController } = require('./scripts/cdp_controller.js');

(async () => { const controller = new CDPController('ws://127.0.0.1:9222/devtools/browser/...'); await controller.connect(); // Navigate await controller.navigate('https://www.taobao.com'); // Fill form await controller.fill('#q', 'iPhone'); await controller.press('Enter'); await controller.wait(3); // Extract data const result = await controller.evaluate( Array.from(document.querySelectorAll('.item')) .slice(0, 10) .map(item => ({ title: item.querySelector('.title')?.textContent.trim(), price: item.querySelector('.price')?.textContent.trim() })) ); console.log(result.result); // Intercept network await controller.startIntercept('*api*'); // ... perform actions ... const responses = controller.getInterceptedResponses(); await controller.close(); })();

πŸ“‹ Tips & Best Practices

  • Wait times: Use wait_for_selector instead of fixed wait when possible
  • Selectors: Prefer ID (#id) > class (.class) > attribute ([attr='value'])
  • Network interception: Start intercepting BEFORE navigating
  • JavaScript: Use evaluate for complex data extraction
  • Screenshots: Useful for debugging
  • View on ClawHub
    TERMINAL
    clawhub install chrome-cdp-controller

    πŸ§ͺ Use this skill with your agent

    Most visitors already have an agent. Pick your environment, install or copy the workflow, then run the smoke-test prompt above.

    πŸ” Can't find the right skill?

    Search 60,000+ AI agent skills β€” free, no login needed.

    Search Skills β†’