Community生产力与协作github.com

browser-use/remote-browser

在沙盒远程机器上控制本地浏览器。当代理在沙盒(无图形界面)中运行时,用于导航网站、与网页交互、填写表单、截图或通过隧道暴露本地开发服务器。

remote-browser 是什么?

这个技能允许在无图形界面的沙盒环境中运行的AI代理,通过远程控制连接客户端机器上的本地浏览器。它结合了Playwright进行浏览器自动化,并自动创建SSH隧道以暴露本地网络服务。用户无需配置网络或手动启动浏览器。该技能支持网页导航、表单填写、截图、API调用、本地开发服务器暴露等常见任务,极大扩展了沙盒环境中AI代理的交互能力。它适用于Claude Code、Codex等基于终端的AI代理平台。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/browser-use/browser-use/tree/main/skills/remote-browser

Installed? Explore more 生产力与协作 skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

remote-browser 是做什么的?

在沙盒远程机器上控制本地浏览器。当代理在沙盒(无图形界面)中运行时,用于导航网站、与网页交互、填写表单、截图或通过隧道暴露本地开发服务器。

工作原理

  1. 您在客户端机器上运行一个轻量级脚本(remote-browser.js)。
  2. 该脚本暴露一个WebSocket端点,AI代理的Playwright自动化可以通过该端点连接到您的本地Chrome实例。
  3. 同时,它通过SSH隧道在沙盒机器上暴露一个随机端口,从而将客户端连接路由到AI代理的运行环境。
  4. AI代理的Playwright引擎连接到该隧道,并能无缝控制您的本地浏览器。

设置

前提条件

  • 客户端机器上已安装Node.js(v16+)。
  • 已通过SSH密钥配置对沙盒机器的SSH访问。
  • 沙盒机器上已安装Playwright(在AI代理环境中,无需GUI)。

步骤1:获取脚本

将 remote-browser.js 下载到您的本地机器。

步骤2:运行客户端

node remote-browser.js

脚本将自动:

  1. 检测已安装的Chrome/Chromium。
  2. 以调试模式启动Chrome。
  3. 建立SSH隧道回到沙盒机器。
  4. 打印连接详情。

步骤3:在代理中使用

AI代理将自动从环境变量(REMOTE_BROWSER_WS_URL)或通过搜索常见位置(如 ~/.remote-browser/ws-url.txt 和 ~/.remote-browser/pid)来检测连接字符串。

环境变量

变量名描述
REMOTE_BROWSER_WS_URL客户端脚本打印的完整WebSocket URL(通常格式为 ws://localhost:PORT)。
REMOTE_BROWSER_PID(可选)用于清理的远程浏览器进程PID。
SSH_TUNNEL_PORT(可选)覆盖自动选择的SSH隧道端口。

示例用法(Playwright)

const { chromium } = require('playwright');
const wsEndpoint = process.env.REMOTE_BROWSER_WS_URL;

async function main() {
  const browser = await chromium.connectOverCDP(wsEndpoint);
  const page = await browser.newPage();
  await page.goto('https://example.com');
  console.log(await page.title());
  await browser.close();
}
main();

故障排除

  • 连接被拒绝:确保Chrome已启动且未被防火墙阻止。客户端脚本运行时会在终端打印状态信息。
  • 隧道失败:验证SSH配置。运行 ssh -v your-sandbox-host 以检查连接。
  • 端口冲突:如果自动选择的端口被占用,脚本会重试不同的端口。您也可以设置 SSH_TUNNEL_PORT 环境变量。
  • 浏览器未找到:脚本会尝试查找标准位置的Chrome。如果未找到,请确保已安装Chrome/Chromium,或通过 --chrome-path 参数提供路径。

清理

使用完毕后,按 Ctrl+C 停止客户端脚本。这将终止Chrome及SSH隧道。如果进程未正确终止,您可能需要手动运行:

kill $(cat ~/.remote-browser/pid) 2>/dev/null; rm -f ~/.remote-browser/pid ~/.remote-browser/ws-url.txt

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

browser-use

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages.

browser-use/cloud

Documentation reference for using Browser Use Cloud — the hosted API and SDK for browser automation. Use this skill whenever the user needs help with the Cloud REST API (v2 or v3), browser-use-sdk (Python or TypeScript), X-Browser-Use-API-Key authentication, cloud sessions, browser profiles, profile sync, CDP WebSocket connections, stealth browsers, residential proxies, CAPTCHA handling, webhooks, workspaces, skills marketplace, liveUrl streaming, pricing, or integration patterns (chat UI, subagent, adding browser tools to existing agents). Also trigger for questions about n8n/Make/Zapier integration, Playwright/ Puppeteer/Selenium on cloud infrastructure, or 1Password vault integration. Do NOT use this for the open-source Python library (Agent, Browser, Tools config) — use the open-source skill instead.

browser-use/open-source

Documentation reference for writing Python code using the browser-use open-source library. Use this skill whenever the user needs help with Agent, Browser, or Tools configuration, is writing code that imports from browser_use, asks about @sandbox deployment, supported LLM models, Actor API, custom tools, lifecycle hooks, MCP server setup, or monitoring/observability with Laminar or OpenLIT. Also trigger for questions about browser-use installation, prompting strategies, or sensitive data handling. Do NOT use this for Cloud API/SDK usage or pricing — use the cloud skill instead. Do NOT use this for directly automating a browser via CLI commands — use the browser-use skill instead.

x402

Set up Browser Use Cloud payments with x402 — pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key. Two setups it works out up front — "just use it" (set up a wallet so you or Claude Code can run cloud browser tasks paid from the wallet — Claude writes and runs throwaway scripts, nothing touches your codebase) or "build it in" (install the SDK and write the key + code into your project). Walks through wallet setup, funding, .env, and a ~$1 test run. Use when the user asks about x402, pay-per-use, USDC payments, or wants Browser Use Cloud without an API key. For the free-tier signup (reverse-CAPTCHA → API key), use `browser-use cloud signup` or the `cloud` skill instead.

相关技能