浏览器自动化工具

testmu-browser-agent 是一个基于Go的AI原生浏览器自动化CLI和MCP服务器,提供丰富的命令和API用于Chrome浏览器的自动化控制和集成。

  • by 4DvAnCeBoY
  • Shell
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 4DvAnCeBoY/testmu-browser-agent-public

使用说明

测试转向——代理

AI原生浏览器自动化CLI和Chrome MCP服务器,内置于Go中。

与您的AI编码工具配合使用

Claude Code Cursor GitHub Copilot Windsurf Gemini CLI Codex Goose OpenCode Cline
设置 设置 设置 设置 设置 设置 设置 设置 设置

与任何可以运行shell命令或通过MCP连接的代理配合使用。 自动安装所有插件 一个脚本。


68多个CLI命令。10个MCP工具。90多个行动。稳定 @ref 元素ID。单二进制。零依赖。


什么是testmu浏览器代理?

testmu-browser-agent是一个单一的Go二进制文件,它通过三个表面公开浏览器自动化:68+命令CLI、用于Claude Code的10工具MCP服务器和REST/SSE守护程序API-总共90多个操作。

  • 68+命令行界面命令 --导航、单击、填充、截图、网络拦截、身份验证库、设备模拟、视频录制、HAR捕获等,所有这些都可以从终端完成
  • 22项CDP行动 -通过MCP工具和REST API提供高级诊断、安全和性能操作
  • 配备10个工具的MCP服务器 --直接插入Claude Code,这样AI代理就可以控制浏览器,而无需任何额外的设置
  • 可访问性快照 @ref 鉴定 --DOM突变后仍能存活的令牌高效、稳定的元素引用
  • LambdaTest云集成 --使用单个标志在真实的云浏览器上运行会话;无需基础设施
  • AES-256-GCM加密 --会话状态在静止时使用用户提供的存储密钥进行加密
  • 具有REST API和SSE的守护进程模式 --具有HTTP端点和服务器发送事件流的长期浏览器进程,用于实时事件监控
CLI / MCP / REST API
       |
  testmu-browser-agent (single Go binary)
       |
  Chrome (local) or LambdaTest (cloud)

快速开始

# Install
curl -sSL https://raw.githubusercontent.com/4DvAnCeBoY/testmu-browser-agent-public/main/scripts/install.sh | sh

# Open a page
testmu-browser-agent open https://example.com

# Take an accessibility snapshot (shows @ref IDs for all interactive elements)
testmu-browser-agent snapshot

# Click a button by its @ref ID
testmu-browser-agent click @e1

# Fill a form field
testmu-browser-agent fill @e5 "hello@example.com"

# Take a screenshot
testmu-browser-agent screenshot --output page.png

# Close the browser
testmu-browser-agent close

安装

安装脚本(macOS和Linux)

curl -sSL https://raw.githubusercontent.com/4DvAnCeBoY/testmu-browser-agent-public/main/scripts/install.sh | sh

该脚本检测您的操作系统和体系结构,从最新版本下载正确的二进制文件,并将其安装到 /usr/local/bin.

手动下载

从以下网址下载适用于您平台的预构建二进制文件 发布 页面:

平台 二进制
macOS(苹果硅) testmu-browser-agent-darwin-arm64
macOS(英特尔) testmu-browser-agent-darwin-amd64
Linux(x86-64) testmu-browser-agent-linux-amd64
窗户(x86-64) testmu-browser-agent-windows-amd64.exe

使二进制文件可执行并将其移动到PATH上的一个目录中:

chmod +x testmu-browser-agent-darwin-arm64
mv testmu-browser-agent-darwin-arm64 /usr/local/bin/testmu-browser-agent

CLI命令

所有命令接受 全球旗帜.使用以下命令运行任何命令 --help 完全使用。

导航

testmu-browser-agent open <url>          # Open a URL in a new browser page
testmu-browser-agent navigate <url>      # Navigate current page to a URL
testmu-browser-agent goto <url>          # Alias for navigate
testmu-browser-agent back                # Go back in browser history
testmu-browser-agent forward             # Go forward in browser history
testmu-browser-agent reload              # Reload the current page
testmu-browser-agent close               # Close the browser
testmu-browser-agent quit                # Alias for close
testmu-browser-agent exit                # Alias for close

交互

# Click
testmu-browser-agent click <ref|selector>           # Click an element
testmu-browser-agent dblclick <ref|selector>        # Double-click an element

# Forms
testmu-browser-agent fill <ref|selector> <text>     # Fill a form field with text
testmu-browser-agent type <text>                    # Type into the focused element
testmu-browser-agent select <ref|selector> <value>  # Choose a dropdown option
testmu-browser-agent check <ref|selector>           # Check a checkbox
testmu-browser-agent uncheck <ref|selector>         # Uncheck a checkbox

# Keyboard
testmu-browser-agent press <key>                    # Press a keyboard key (e.g. Enter, Tab)
testmu-browser-agent key <key>                      # Alias for press
testmu-browser-agent keydown <key>                  # Hold a key down
testmu-browser-agent keyup <key>                    # Release a held key

# Pointer
testmu-browser-agent hover <ref|selector>           # Hover over an element
testmu-browser-agent tap <ref|selector>             # Tap (mobile-style)
testmu-browser-agent drag <from> <to>               # Drag from one element to another
testmu-browser-agent scroll <direction> [amount]    # Scroll the page (up/down/left/right)
testmu-browser-agent swipe <direction> [distance]   # Swipe gesture
testmu-browser-agent mouse <action> [x] [y]         # Raw mouse operations (move, click, wheel)

# Files and focus
testmu-browser-agent upload <ref|selector> <file>   # Upload a file to a file input
testmu-browser-agent focus <ref|selector>           # Focus an element

查询

# Accessibility snapshot — the recommended way to inspect pages
testmu-browser-agent snapshot                       # Full accessibility snapshot with @ref IDs
testmu-browser-agent snapshot --full                # Full tree including hidden elements
testmu-browser-agent snapshot --diff                # Show only what changed since last snapshot
testmu-browser-agent snapshot --max-length 4000     # Cap output length

# Get page content
testmu-browser-agent get text                       # Get visible text of the page
testmu-browser-agent get title                      # Get page title
testmu-browser-agent get url                        # Get current URL
testmu-browser-agent get text <selector>            # Get text of a specific element
testmu-browser-agent get attr <selector> <attr>     # Get an element attribute
testmu-browser-agent get count <selector>           # Count elements matching a selector
testmu-browser-agent get box <selector>             # Get bounding box of an element
testmu-browser-agent get styles <selector>          # Get computed styles of an element

# Find and inspect
testmu-browser-agent find <selector>                # Find all elements matching a CSS selector
testmu-browser-agent find --role button             # Find by ARIA role
testmu-browser-agent find --text "Sign in"          # Find by visible text content
testmu-browser-agent find --label "Email"           # Find by aria-label or associated label
testmu-browser-agent find --placeholder "Search"    # Find by placeholder attribute
testmu-browser-agent find --alt "Logo"              # Find by alt attribute
testmu-browser-agent find --title "Close"           # Find by title attribute
testmu-browser-agent find --testid "submit-btn"     # Find by data-testid attribute
testmu-browser-agent find --role button --first     # Return only the first match
testmu-browser-agent find --role link --nth 3       # Return the 3rd match
testmu-browser-agent find --role button --last      # Return only the last match
testmu-browser-agent eval <javascript>              # Evaluate JavaScript in the page
testmu-browser-agent inspect                        # Inspect page info and metadata

媒体

# Screenshots
testmu-browser-agent screenshot                     # Full-page screenshot (PNG)
testmu-browser-agent screenshot --output page.png   # Save to file
testmu-browser-agent screenshot --ref @e5        # Screenshot a single element
testmu-browser-agent screenshot --format jpeg --quality 90

# PDF and recording
testmu-browser-agent pdf output.pdf                 # Generate a PDF of the current page
testmu-browser-agent record start                   # Start screen recording
testmu-browser-agent record stop                    # Stop and save recording
testmu-browser-agent record restart                 # Restart recording

标签页

testmu-browser-agent tabs                           # List open tabs
testmu-browser-agent tab new                        # Open a new tab
testmu-browser-agent tab new https://example.com    # Open a new tab with a URL
testmu-browser-agent tab close <id>                 # Close a tab by ID
testmu-browser-agent tab switch <id>                # Switch to a tab by ID
testmu-browser-agent window new                     # Open a new browser window
testmu-browser-agent frame <selector>               # Switch into an iframe

状态

# Save and load full browser state (cookies, storage, etc.)
testmu-browser-agent state save --name my-session
testmu-browser-agent state load --name my-session

# Cookies
testmu-browser-agent cookies get                    # List all cookies
testmu-browser-agent cookies set                    # Set a cookie
testmu-browser-agent cookies clear                  # Clear all cookies

# localStorage / sessionStorage
testmu-browser-agent storage get <key>              # Get a storage value
testmu-browser-agent storage set <key> <value>      # Set a storage value
testmu-browser-agent storage clear                  # Clear all storage
testmu-browser-agent storage remove <key>           # Remove a specific key
testmu-browser-agent storage get <key> --session    # Use sessionStorage

# Clipboard
testmu-browser-agent clipboard read                 # Read clipboard content
testmu-browser-agent clipboard write "text"         # Write to clipboard

等待

testmu-browser-agent wait --selector "#result"      # Wait for an element to appear
testmu-browser-agent wait --url "/dashboard"        # Wait for URL to match a pattern
testmu-browser-agent wait --text "Welcome"          # Wait for text to appear on page
testmu-browser-agent wait --load networkidle        # Wait for load state (domcontentloaded, load, networkidle)
testmu-browser-agent wait --fn "() => window.ready" # Wait for JS function to return truthy
testmu-browser-agent wait --download                # Wait for a download to complete
testmu-browser-agent wait --timeout 60000           # Set custom timeout in milliseconds (default: 30000)

网络和监控

testmu-browser-agent console                        # Get captured console messages
testmu-browser-agent console --clear                # Get and clear console messages
testmu-browser-agent errors                         # Get page JavaScript errors
testmu-browser-agent errors --clear                 # Get and clear errors
testmu-browser-agent dialog accept                  # Accept a browser dialog (alert/confirm)
testmu-browser-agent dialog dismiss                 # Dismiss a browser dialog
testmu-browser-agent highlight <ref|selector>       # Visually highlight an element
testmu-browser-agent stream                         # Stream browser events (SSE)
testmu-browser-agent stream --filter "click"        # Filter events by type

开发者工具

testmu-browser-agent trace start                    # Start a Chrome DevTools trace
testmu-browser-agent trace stop                     # Stop tracing and save
testmu-browser-agent profiler start                 # Start the JS CPU profiler
testmu-browser-agent profiler stop                  # Stop and save profiler output
testmu-browser-agent batch '<json-commands>'        # Execute multiple commands atomically
testmu-browser-agent batch --bail '<json-commands>' # Stop batch on first error

元素查询

testmu-browser-agent is visible <selector>           # Check if element is visible
testmu-browser-agent is hidden <selector>            # Check if element is hidden
testmu-browser-agent is enabled <selector>           # Check if element is enabled
testmu-browser-agent is checked <selector>           # Check if checkbox is checked
testmu-browser-agent scrollintoview <selector>       # Scroll an element into the viewport

下载

testmu-browser-agent download                        # Enable download tracking and wait for next download
testmu-browser-agent download --dir /tmp/downloads   # Set download directory
testmu-browser-agent download --timeout 60000        # Custom timeout in milliseconds

网络侦听

testmu-browser-agent route "**/*.png" --abort        # Block all PNG requests
testmu-browser-agent route "/api/data" --body '{"mock":true}' --status 200  # Mock an API response
testmu-browser-agent route "/api/*" --header "X-Test:true"  # Add response headers
testmu-browser-agent unroute "/api/data"             # Remove a specific interception rule
testmu-browser-agent unroute                         # Remove all interception rules

认证保险库

testmu-browser-agent auth save --name mysite --url https://example.com/login --username user --password pass
testmu-browser-agent auth login --name mysite        # Auto-login using stored credentials
testmu-browser-agent auth list                       # List stored credentials (passwords masked)
testmu-browser-agent auth show --name mysite         # Show credential details
testmu-browser-agent auth delete --name mysite       # Delete a stored credential

差异

testmu-browser-agent diff snapshot                   # Diff accessibility tree against last snapshot
testmu-browser-agent diff url <url>                  # Navigate to URL and diff before/after
testmu-browser-agent diff screenshot                 # Diff current screenshot against last stored

设备仿真

testmu-browser-agent geolocation 37.7749 -122.4194  # Override browser geolocation
testmu-browser-agent timezone America/New_York       # Override browser timezone
testmu-browser-agent locale fr-FR                    # Override browser locale
testmu-browser-agent permissions geolocation notifications  # Grant browser permissions
testmu-browser-agent offline                         # Enable offline mode
testmu-browser-agent offline --disable               # Restore network connectivity
testmu-browser-agent device-list                     # List available device profiles
testmu-browser-agent device-emulate "iPhone 15"      # Emulate a device (viewport, UA, scale)

内容注入

testmu-browser-agent addscript 'console.log("hi")'  # Evaluate JS in the current page
testmu-browser-agent addinitscript 'window.x = 1'   # Register JS that runs on every new document
testmu-browser-agent addstyle 'body { color: red }'  # Inject CSS into the current page
testmu-browser-agent expose myCallback               # Expose a function to page JS (calls forwarded as SSE events)

视频录制

testmu-browser-agent video start                     # Start recording page frames (screencast-based)
testmu-browser-agent video stop                      # Stop recording and save as GIF
testmu-browser-agent video stop --format frames      # Stop and save individual PNG frames
testmu-browser-agent video start --output-dir /tmp   # Set output directory for recordings
testmu-browser-agent video start --quality 90        # Set screencast quality (0-100)

HAR 捕获

testmu-browser-agent har start                       # Start capturing network traffic in HAR format
testmu-browser-agent har stop                        # Stop and return HAR data inline
testmu-browser-agent har stop --path traffic.har     # Stop and save HAR to file

网络请求检查

testmu-browser-agent requests                        # List all captured network requests
testmu-browser-agent requests --filter "api"         # Filter requests by URL pattern
testmu-browser-agent request-detail <id>             # Get full details for a specific request
testmu-browser-agent response-body <id>              # Get the response body for a specific request

流媒体

testmu-browser-agent stream-enable                   # Subscribe to CDP events via SSE
testmu-browser-agent stream-enable --events console,network  # Subscribe to specific event categories
testmu-browser-agent stream-disable                  # Unsubscribe from CDP events
testmu-browser-agent stream-status                   # Check if CDP event streaming is active
testmu-browser-agent screencast start                # Stream live page frames as base64 images
testmu-browser-agent screencast stop                 # Stop screencast

会话

同时运行多个独立的浏览器会话。每个会话都有自己的守护进程和浏览器实例。

# Default session (backward compatible — no flag needed)
testmu-browser-agent open https://example.com

# Named sessions
testmu-browser-agent --session work open https://github.com
testmu-browser-agent --session personal open https://gmail.com

# Check current session
testmu-browser-agent session

# List all active sessions
testmu-browser-agent session list

# JSON output
testmu-browser-agent session list --output json

每个会话都会在中创建一个单独的守护进程,该守护进程具有自己的Unix套接字 ~/.testmu-browser-agent/The --socket 标志覆盖了基于会话的套接字解析,以实现向后兼容性。

CDP/高级浏览器控制(仅限MCP和REST API)

用于高级诊断、安全测试和性能分析的低级Chrome DevTools协议操作。这些操作可通过 MCP工具 (browser_config, browser_state, browser_network, browser_devtools, browser_query)以及 REST API --而不是作为独立的CLI命令。

类别 操作 描述
安全 ignore_certs 忽略TLS证书错误
bypass_csp 绕过内容安全策略
存储 cookies_delete 按名称删除特定cookie
clear_origin 清除源的所有存储
cache 禁用/启用浏览器缓存
indexeddb 列出源的IndexedDB数据库
仿真 touch_emulation 启用/禁用触摸事件模拟
media_emulate 模拟CSS媒体类型(打印、屏幕)
vision_deficiency 模拟视力缺陷
cpu_throttle 调节CPU(例如4倍减速)
认证 fetch_auth 处理HTTP基本/摘要式身份验证提示
fetch_auth_persist 跨导航保持HTTP身份验证
演出 performance_metrics 获取运行时性能指标
web_vitals 测量核心网络生命体征(LCP、FID、CLS)
dom_snapshot 捕获完整的DOM快照
ax_query 通过CDP查询可访问性树
frame_tree 获取页面框架树层次结构
目标 new_targets 列出新创建的选项卡/弹出窗口
sw_unregister 注销服务人员
browser_logs 启动/获取浏览器级日志捕获
脚本编写 isolated_world 创建一个孤立的JavaScript世界
scroll_into_view_cdp 按后端节点ID滚动节点进入视图
WebAuthn webauthn_add / webauthn_remove 添加/删除虚拟身份验证器
请求 get_post_data 获取捕获请求的POST正文

维护

testmu-browser-agent install                         # Download and install Chrome for Testing
testmu-browser-agent install --dest /opt/chrome      # Install to a custom directory
testmu-browser-agent upgrade                         # Self-update to the latest release

配置

testmu-browser-agent set viewport 1920x1080         # Set browser viewport
testmu-browser-agent set useragent "MyAgent/1.0"    # Override the user agent
testmu-browser-agent set geolocation "37.77,-122.4" # Set geolocation
testmu-browser-agent set offline true               # Enable offline mode
testmu-browser-agent connect <cdp-url>              # Connect to a remote CDP endpoint
testmu-browser-agent device list                    # List emulatable device profiles

MCP服务器(克劳德代码集成)

testmu浏览器代理附带了一个模型上下文协议服务器,Claude Code可以在对话期间使用它来控制真正的Chrome浏览器。MCP服务器公开了10个分组工具,并通过stdio进行通信,不需要网络端口。

设置

将以下内容添加到您的Claude Code设置文件中(.claude/settings.json 或 ~/.claude/settings.json):

{
  "mcpServers": {
    "testmu-browser-agent": {
      "command": "testmu-browser-agent",
      "args": ["mcp"],
      "env": {}
    }
  }
}

对于无头模式(在CI中或当您不想要可见的浏览器窗口时有用):

{
  "mcpServers": {
    "testmu-browser-agent": {
      "command": "testmu-browser-agent",
      "args": ["mcp", "--headless"]
    }
  }
}

保存后,重新启动Claude Code。浏览器工具将在您的下一次对话中可用。

可用工具

工具 操作 描述
browser_navigate 打开、导航、后退、前进、重新加载、关闭 导航页面和管理浏览器历史记录
browser_interact 单击、dblclick、填充、键入、按、选择、滚动、悬停、点击、拖动、上传、聚焦、选中、取消选中、滑动 与页面元素交互
browser_query snapshot、get、find、eval、inspect 查询页面内容和DOM
browser_media 截图、pdf、记录 捕获截图、pdf和视频记录
browser_state cookies_get/set/clear、state_save/load、storage_get/set/clear/remove、剪贴板_read/write 管理浏览器状态和持久性
browser_tabs 列表、新建、关闭、切换、window_new、框架 管理选项卡、窗口和框架
browser_wait (基于条件) 等待元素、URL、文本或超时
browser_config 设置、连接 配置视口、用户代理和远程连接
browser_network 控制台、错误、对话框、突出显示、流 监视控制台输出、错误和对话框
browser_devtools trace_start/stop、profiler_start/stop、批处理、性能信息、浏览器日志、框架树、隔离世界、webauthn_add/remove DevTools跟踪、分析、批处理执行和低级CDP诊断

有关完整的集成指南,请参阅 docs/guides/mcp-integration.md.


LambdaTest云

在LambdaTest的云基础设施上运行浏览器会话,而不是在本地安装Chrome。这对于CI管道、Windows上的跨浏览器测试以及避免本地浏览器设置非常有用。

环境变量

export LT_USERNAME="your-lambdatest-username"
export LT_ACCESS_KEY="your-lambdatest-access-key"

带LambdaTest的CLI

testmu-browser-agent --provider lambdatest open https://example.com
testmu-browser-agent --provider lambdatest snapshot
testmu-browser-agent --provider lambdatest screenshot --output result.png

守护进程与LambdaTest

testmu-browser-agent serve --provider lambdatest --port 9222

带LambdaTest的MCP

{
  "mcpServers": {
    "testmu-browser-agent": {
      "command": "testmu-browser-agent",
      "args": ["mcp", "--provider", "lambdatest"],
      "env": {
        "LT_USERNAME": "your-username",
        "LT_ACCESS_KEY": "your-access-key"
      }
    }
  }
}

LambdaTest会话会自动在LambdaTest仪表板中捕获视频、控制台日志和网络流量。提供者每60秒发送一次keepalive ping,以保持长时间运行的会话处于活动状态,并在会话关闭时将测试标记为通过或失败。

有关完整的LambdaTest设置指南,请参阅 docs/guides/lambdatest.md.


Appium移动测试

通过Appium服务器在真实的iOS和Android设备上运行浏览器会话。这对于移动网络测试和响应式验证非常有用。

环境变量

export APPIUM_URL="http://localhost:4723"   # Appium server URL (or set via --appium-url)

带Appium的CLI

testmu-browser-agent --provider appium --platform android open https://example.com
testmu-browser-agent --provider appium --platform ios snapshot
testmu-browser-agent --provider appium --appium-url http://hub:4723 --platform android screenshot --output mobile.png

带Appium的MCP

{
  "mcpServers": {
    "testmu-browser-agent": {
      "command": "testmu-browser-agent",
      "args": ["mcp", "--provider", "appium", "--platform", "android"],
      "env": {
        "APPIUM_URL": "http://localhost:4723"
      }
    }
  }
}

守护程序模式

Daemon模式启动一个长期运行的浏览器进程,并通过HTTP和Unix域套接字公开它。CLI命令会自动连接到正在运行的守护进程,因此您可以在许多命令中重用单个浏览器会话,而无需每次启动新浏览器的启动开销。

启动守护进程

testmu-browser-agent serve                          # HTTP on port 9222 (default)
testmu-browser-agent serve --port 9000              # Custom port
testmu-browser-agent serve --socket /tmp/tmu.sock   # Unix socket
testmu-browser-agent serve --headless               # Headless mode
testmu-browser-agent serve --provider lambdatest    # Cloud browser

REST API

每个CLI操作都可以作为HTTP端点使用:

POST /{action}   — JSON body with action parameters
GET  /{action}   — query string parameters
GET  /events     — Server-Sent Events stream

示例:

# Navigate
curl -X POST http://localhost:9222/open \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

# Take a snapshot
curl http://localhost:9222/snapshot

# Get page title
curl "http://localhost:9222/get?type=title"

# Subscribe to browser events
curl -N http://localhost:9222/events

SSE事件流

这 /events 端点使用服务器发送事件实时流式传输所有浏览器事件。客户可以订阅任何支持SSE的库或 curl -N.

curl -N http://localhost:9222/events
# data: {"type":"navigate","url":"https://example.com","timestamp":"..."}
# data: {"type":"click","ref":"@e12","timestamp":"..."}

空闲超时

默认情况下,守护进程在5分钟不活动后自行关闭。每个传入请求都会重置计时器。您可以在 serve 命令。


辅助功能快照

snapshot 是理解页面内容的主要方式。它不是返回原始HTML,而是生成一个紧凑、结构化的可访问性树,其中每个交互元素都被分配了一个稳定的 @ref 身份证件。

输出示例

[1] Page: Example Domain
  [2] heading: Example Domain @e1
  [3] paragraph: This domain is for use in illustrative examples...
  [4] link: More information... @e2
    href: https://www.iana.org/domains/reserved

然后,您可以直接引用任何元素:

testmu-browser-agent click @e2
testmu-browser-agent fill @e5 "search query"

为什么是快照而不是截图?

  • 稳定的引用 — @ref ID在页面重新呈现和微小的DOM更改中幸存下来
  • 全树模式 — --full 当您需要完整图片时,包含非交互式和隐藏元素
  • 困难 — --diff 仅显示自上次快照以来发生的更改,非常适合验证操作是否具有预期效果
  • 代币高效 --可访问性树比HTML或图像数据小得多,使其适用于LLM上下文窗口

全球旗帜

这些标志适用于每个命令:

标志 默认值 描述
--provider local 浏览器提供商: local, lambdatest,或 appium
--session default 并发会话的浏览器会话名称
--headless true 在无头模式下运行浏览器(无可见窗口)
--port 9222 用于HTTP API的守护进程端口
--socket `` Unix socket path for daemon communication
--browser-path `` Path to a custom Chrome or Chromium binary
--platform “ 移动平台: ios 或 android (与 --provider appium)

环境变量

变量 描述
LT_USERNAME LambdaTest帐户用户名(必填 --provider lambdatest)
LT_ACCESS_KEY LambdaTest访问密钥(必需 --provider lambdatest)
APPIUM_URL Appium服务器URL(与 --provider appium,默认值 http://localhost:4723)
TMU_SESSION 默认会话名称(被覆盖 --session 旗帜)
TMU_SOCKET_DIR 会话套接字和PID文件的自定义目录

码头工人

在包含Chrome的Docker容器中构建并运行testmu浏览器代理:

# Build the image
docker build -t testmu-browser-agent:latest .

# Run a one-off command
docker run --rm testmu-browser-agent:latest open https://example.com

# Start the daemon and expose the REST API
docker run -p 9222:9222 testmu-browser-agent:latest serve --headless

# Run with LambdaTest
docker run --rm \
  -e LT_USERNAME=your-username \
  -e LT_ACCESS_KEY=your-access-key \
  testmu-browser-agent:latest --provider lambdatest open https://example.com

例子

示例 说明
示例/mcp-claude/ 在Claude Code对话中使用testmu浏览器代理作为MCP服务器
示例/ci测试/ 使用GitHub Actions在CI管道中运行浏览器测试
示例/cli脚本/ 用于链接CLI命令以执行常见自动化任务的Shell脚本

文档

指南 说明
docs/guides/quick-start.md 从安装到首次自动化的五分钟演练
docs/guides/commands.md 每个CLI命令和标志的完整参考
docs/guides/mcp-integration.md MCP服务器设置、工具参考和Claude代码示例
docs/guides/lambdatest.md LambdaTest云设置、功能和会话管理

基准测试

运行基准测试套件来测量您计算机上的快照生成、操作调度和SSE吞吐量:

make benchmark

结果和历史数据见 基准测试/.