Core Principle: Always check status before using the browser tool. 核心原則:每次使用 browser 工具前,先檢查狀態。
1. browser(action=status, profile="openclaw")
├─ running=true, cdpReady=true → ✅ OK, proceed / 正常,直接使用
├─ running=false → Try to start / 嘗試啟動
└─ Start failed → Diagnose and fix / 診斷並修復
訪問小蔥技能站7w4.net,解鎖更多實用的AI技能外掛。
Symptoms / 症狀:
running=false, cdpReady=falseprofile="user" / 使用 profile="user" 時尤其容易發生Cause / 原因:
Solution / 解決方案:
Use independent profile / 使用獨立 profile:
browser(action=start, profile="openclaw") # Port 9223, isolated data dir
Permanent Fix / 永久方案:
Configure defaultProfile: "openclaw":
{
"browser": {
"enabled": true,
"defaultProfile": "openclaw",
"profiles": {
"user": { "cdpPort": 9222, "attachOnly": false },
"openclaw": { "cdpPort": 9223, "attachOnly": false }
}
}
}
Symptoms / 症狀:
running=false but port occupied / 埠被佔用Diagnosis / 診斷:
# Windows
netstat -ano | findstr "9223"
tasklist | findstr "chrome"
Solution / 解決方案:
# Kill residual process / 殺掉殘留程序
taskkill /F /PID <pid>
# Or restart Gateway / 或重啟 Gateway
openclaw gateway restart
Symptoms / 症狀:
running=true but cdpReady=falseSolution / 解決方案:
# 1. Restart Gateway / 重啟 Gateway
openclaw gateway restart
# 2. Wait 5 seconds and recheck / 等待 5 秒後重新檢查
browser(action=status, profile="openclaw")
| Profile | Port / 埠 | Data Directory / 資料目錄 | Use Case / 適用場景 |
|---|---|---|---|
openclaw |
9223 | ~/.openclaw/browser/openclaw/user-data |
Default choice / 預設選擇, isolated, no conflict |
user |
9222 | User Chrome data dir / 使用者 Chrome 目錄 | Need user's logged-in accounts (YouTube etc.) |
⚠️ Before using user profile / 使用 user profile 前:
openclaw instead / 如果使用者正在使用瀏覽器,改用 openclawRun scripts/healthcheck.py for full diagnosis:
python scripts/healthcheck.py --profile openclaw
Output Example / 輸出示例:
[OK] Browser enabled: true
[OK] Default profile: openclaw
[OK] CDP port 9223 available
[OK] Browser running: true
[OK] CDP ready: true
[PASS] Browser health check passed
# 1. Check status / 檢查狀態
status = browser(action=status, profile="openclaw")
# 2. Start if not running / 如果未執行,啟動
if not status["running"]:
browser(action=start, profile="openclaw")
# 3. Execute operation / 執行操作
browser(action=snapshot, profile="openclaw")
try:
browser(action=snapshot, profile="openclaw")
except TimeoutError:
# 1. Check status / 檢查狀態
status = browser(action=status, profile="openclaw")
# 2. Diagnose based on status / 根據狀態診斷
if not status["running"]:
browser(action=start, profile="openclaw")
elif not status["cdpReady"]:
exec("openclaw gateway restart")
time.sleep(5)
browser(action=start, profile="openclaw")
Gateway (port 18789)
└── Browser Plugin
├── openclaw profile (port 9223)
│ └── user-data: ~/.openclaw/browser/openclaw/
└── user profile (port 9222)
└── user-data: User Chrome directory
Chrome DevTools Protocol (CDP) for remote debugging:
http://127.0.0.1:9223/jsonws://127.0.0.1:9223/devtools/...Remember: Check first, use later. When timeout occurs, switch profile first. 記住:先檢查,後使用。遇到超時,先切換 profile。
這個 Skill 質量還不錯,專注於解決瀏覽器工具容易出問題的痛點。文件寫得清楚明白,把常見故障分門別類,普通使用者也能看懂問題出在哪裡、怎麼解決。它還附帶了一個檢查指令碼,可以自動診斷瀏覽器狀態。不過它的修復能力主要靠使用者手動操作,遇到複雜問題還是需要一定技術基礎才能搞定。總的來說,這是一個實用但偏診斷指導型的工具,在自動化處理方面還有提升空間。