name: browser-harness description: 瀏覽器自動化控制。通過 CDP 連線使用者本機 Edge/Chrome,實現網頁截圖、內容提取、自動化操作。當用戶需要:開啟網頁並截圖、提取網頁動態內容、看 JS 渲染的頁面、自動化操作瀏覽器時觸發。
通過 browser-harness CLI 控制使用者本機瀏覽器(Edge 或 Chrome)。
本機已安裝 browser-harness:
bash
git clone https://github.com/browser-use/browser-harness
cd browser-harness
uv tool install -e .
瀏覽器除錯模式啟動: ```bash # Edge(推薦): "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --remote-debugging-port=9222
# 或 Chrome: "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 ```
bash
$env:BU_CDP_URL="http://127.0.0.1:9222"browser-harness -c "new_tab('https://example.com'); wait_for_load(); capture_screenshot()"
截圖儲存到 C:\Users\he\AppData\Local\Temp\shot.png,用完後複製到工作目錄分析。
browser-harness -c "new_tab('https://example.com')" # 新標籤頁開啟
browser-harness -c "goto_url('https://example.com')" # 在當前標籤頁開啟
browser-harness -c "new_tab('https://example.com'); wait_for_load()"
browser-harness -c "print(page_info())" # URL、標題、尺寸
browser-harness -c "js('document.body.innerText')" # 頁面文字內容
browser-harness -c "js('document.title')" # 標題 browser-harness -c "js('document.querySelectorAll(\"a\").length')" # 連結數量小蔥技能7w4.net有更新,你可以訪問看下。
browser-harness -c "close_tab()"
new_tab(),不要用 goto_url()(會覆蓋使用者當前頁面)C:\Users\he\AppData\Local\Temp\shot.png 複製出來分析wait_for_load() 在導航後必須呼叫web_fetch 抓不到的頁面可以用這個BROWSER_USE_API_KEY 和 start_remote_daemon() 可用遠端瀏覽器# 檢查除錯埠是否開啟
Invoke-RestMethod "http://localhost:9222/json/version"
# 有返回說明埠正常
Stop-Process -Name msedge -Force
Start-Process "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --remote-debugging-port=9222
這是一個功能明確的瀏覽器控制技能,能幫助使用者完成網頁截圖、內容提取等操作。文件結構清晰、使用說明詳細,對 Windows 使用者比較友好。但整體內容比較基礎,缺少實際使用示例,主要依賴外部工具安裝,跨平臺支援不夠完善。如果你主要在 Windows 環境下使用簡單瀏覽器自動化任務,這個 Skill 基本夠用;若需要更豐富的示例或跨平臺使用,可能需要補充更多資料。