web-infra-dev/midscene 詳細教學
對
web-infra-dev/midscene從「定位」→「跑起來」→「整合進產品」的完整 onboarding。 補充inbox/2026-05-23-github-web-infra-dev-midscene.md(gh-save metadata),請搭配閱讀。
1. 專案定位
Midscene.js 是 ByteDance web-infra-dev 團隊(同團隊作品:Rsbuild / Rslib / Rspack)開源的「用視覺語言模型 (VLM; Visual Language Model) 跑 UI 自動化」框架。
核心理念
- 自然語言 = 自動化腳本:用「幫我點搜尋按鈕、輸入 ‘midscene’、按 Enter」這種句子直接描述步驟,框架自動 plan + execute
- 純視覺路線(v1.8+):UI 互動只看 screenshot,不靠 DOM。意味著可控
<canvas>/ 自製 widget / 任何 GUI(包含手機 app) - 全平台覆蓋:同一套 SDK 跑 web / Android / iOS / desktop / Harmony OS
與既有方案對比
| 維度 | Playwright (raw) | Selenium | Midscene |
|---|---|---|---|
| 寫法 | 程式碼 + selector | 程式碼 + selector | 自然語言 + AI plan |
| 平台 | Web only | Web + 一些 mobile | Web + Android + iOS + Desktop + Harmony |
| 對動態 DOM | 脆弱 | 脆弱 | screenshot 不變即穩定 |
對 <canvas> | ❌ | ❌ | ✅ 純視覺可控 |
| Token 成本 | N/A | N/A | 純 vision action 省 ~50-70%(vs vision + DOM) |
| LLM dependency | 無 | 無 | 必要(VLM API key) |
| 適合 | precise 程式測試 | legacy | AI agent / 跨平台 / 動態 UI |
支援的 VLM
| 模型 | 來源 | 適用 |
|---|---|---|
| UI-TARS (1.5-7B) | ByteDance(開源) | 自架、self-host |
| Qwen3-VL | 阿里(開源) | 雲服務 / 自架 |
| Doubao-1.6-vision | ByteDance | API |
| gemini-3-pro | API | |
| 多種其他(GPT-4o、Claude) | OpenAI / Anthropic | API |
適用場景
- E2E 自動測試(比 Playwright code 短 5-10×)
- 跨平台 UI agent(手機 / web 同時)
- LLM agent 操作 GUI(MCP 整合)
- Canvas-heavy 應用(地圖、繪圖、遊戲 UI)
- 跨團隊測試(QA 工程師寫自然語言;無需 selector 經驗)
不適用場景
- 完全 deterministic / repeatable 的 unit test(VLM 有不確定性)
- 對 latency 敏感(每步要送 screenshot 給 VLM,~ 1-3 s/step)
- 預算極緊的 large-scale CI(VLM token 累積)— 用 caching mode 緩解
2. 安裝指南
2.1 環境需求
| 項目 | 值 |
|---|---|
| Node.js | ≥ 18.19 |
| pnpm | ≥ 9.3(必須 pnpm,不支援 npm/yarn) |
| OS | macOS / Linux 主要;Windows 須 PowerShell + WSL2 |
| VLM API | OpenAI / 自架 UI-TARS / Doubao / Gemini / Qwen 任一 |
2.2 三條 install path
A. 用既有 Playwright / Puppeteer 專案(最快)
1# 已有 Playwright 專案的話
2npm install --save-dev @midscene/web
3
4# 環境變數
5export MIDSCENE_MODEL_BASE_URL="https://api.openai.com/v1"
6export MIDSCENE_MODEL_NAME="gpt-4o"
7export OPENAI_API_KEY="sk-..."
然後在 test code:
1import { test, expect } from '@playwright/test';
2import { PlaywrightAgent } from '@midscene/web/playwright';
3
4test('search midscene on GitHub', async ({ page }) => {
5 await page.goto('https://github.com');
6 const agent = new PlaywrightAgent(page);
7
8 await agent.aiAction('input "midscene" in search box, press Enter');
9 await agent.aiAssert('the first result is web-infra-dev/midscene');
10});
B. 零代碼 Chrome Extension
去 midscenejs.com/quick-experience → 安裝 Chrome Extension → 在 popup 內用自然語言下指令 → 直接看效果。不寫一行 code。
C. Android / iOS / Desktop
1# Android(需要 adb 在 PATH)
2npm install -g @midscene/cli @midscene/android
3
4# iOS(macOS only,需要 Xcode + WebDriverAgent)
5brew install ios-webkit-debug-proxy
6npm install -g @midscene/cli @midscene/ios
7
8# Desktop computer-use
9npm install -g @midscene/cli @midscene/computer
2.3 自架 UI-TARS(self-host VLM)
1# vLLM serve UI-TARS-1.5-7B
2pip install vllm
3python -m vllm.entrypoints.openai.api_server \
4 --model ByteDance-Seed/UI-TARS-1.5-7B \
5 --port 8080 \
6 --gpu-memory-utilization 0.9
7
8# Midscene 端
9export MIDSCENE_MODEL_BASE_URL="http://localhost:8080/v1"
10export MIDSCENE_MODEL_NAME="ByteDance-Seed/UI-TARS-1.5-7B"
11export OPENAI_API_KEY="sk-empty" # vLLM 不檢查
H100 / A100 跑 7B 推理 latency ~1 s/step。
2.4 開發版安裝(contributor)
1git clone https://github.com/web-infra-dev/midscene
2cd midscene
3pnpm install # 必須 pnpm
4pnpm run build:packages # build 所有 packages
5pnpm run dev # 同時 watch 多個 package
2.5 Mermaid:安裝決策樹
flowchart TD
Start([我想用 Midscene]) --> Goal{目的?}
Goal -->|快速試玩| Ext[Chrome Extension
zero-code]
Goal -->|寫測試 / 寫 SDK| Sdk[npm install @midscene/web]
Goal -->|多平台 / mobile| Cli[npm install @midscene/cli
+ @midscene/android 或 ios]
Goal -->|contribute| Dev[git clone
pnpm install]
Sdk --> ModelChoice{VLM provider?}
Cli --> ModelChoice
Ext --> ModelChoice
ModelChoice -->|OpenAI / Doubao / Gemini| Cloud[set MIDSCENE_MODEL_BASE_URL
+ API key]
ModelChoice -->|self-host UI-TARS| Self[vLLM serve UI-TARS-1.5-7B
port 8080]
Cloud --> Ready([開始寫腳本])
Self --> Ready
Dev --> Ready
3. 核心架構解析
3.1 Monorepo 結構(27 packages + 8 apps)
1midscene/
2├── packages/ # 27 個 npm 套件
3│ ├── core/ # AI plan + agent loop 核心
4│ ├── shared/ # 共用 types / utils
5│ ├── cli/ # CLI(YAML 自動化)
6│ ├── mcp/ # MCP server(atomic tools for upper agents)
7│ ├── visualizer/ # 視覺化回放
8│ ├── recorder/ # 互動錄製
9│ ├── evaluation/ # 模型評測
10│ │
11│ ├── web-integration/ # Playwright + Puppeteer + Bridge mode
12│ ├── web-bridge-mcp/ # Bridge mode 的 MCP server
13│ │
14│ ├── android/ # adb + scrcpy(Android 控制)
15│ ├── android-mcp/ # Android MCP server
16│ ├── android-playground/ # Android local playground
17│ │
18│ ├── ios/ # WebDriverAgent(iOS)
19│ ├── ios-mcp/
20│ ├── ios-playground/
21│ │
22│ ├── computer/ # 桌面通用(xvfb / RDP)
23│ ├── computer-{linux,mac,win}/ # 平台特化
24│ ├── computer-mcp/
25│ ├── computer-playground/
26│ │
27│ ├── harmony/ # Huawei Harmony OS(hdc)
28│ ├── harmony-mcp/
29│ ├── harmony-playground/
30│ │
31│ ├── webdriver/ # WebDriver protocol
32│ ├── playground/ # 共用 playground 基底
33│ └── playground-app/
34│
35├── apps/ # 8 個應用
36│ ├── chrome-extension/ # 零代碼 web 體驗
37│ ├── studio/ # Electron 桌面 GUI
38│ ├── report/ # HTML 回放報告
39│ ├── site/ # midscenejs.com 主站
40│ ├── playground/ # 主 playground
41│ ├── android-playground/
42│ ├── computer-playground/
43│ └── recorder-form/ # 互動錄製 UI
44│
45├── package.json # pnpm workspace + nx
46├── pnpm-workspace.yaml
47├── nx.json # Nx monorepo 設定
48├── biome.json # 取代 ESLint + Prettier
49└── AGENTS.md # 內部設計原則(agent rules)
3.2 系統架構圖
flowchart LR
subgraph User["使用者"]
Nat[自然語言指令
'點搜尋按鈕、輸入 midscene']
end
subgraph Core["@midscene/core (TypeScript)"]
Plan[Action Planner
把自然語言拆成
atomic steps]
Loop[Agent Loop
step → screenshot →
VLM → action]
Cache[Cache layer
localize bbox]
Report[Report Generator
HTML 回放]
end
subgraph VLM["VLM Provider"]
Vlm[UI-TARS / Qwen3-VL /
Doubao / Gemini / GPT-4o]
end
subgraph Platforms["平台適配層"]
Web[web-integration
Playwright / Puppeteer / Bridge]
Adb[android
adb + scrcpy]
Wda[ios
WebDriverAgent]
Pc[computer
xvfb / RDP / native]
Hm[harmony
hdc]
end
subgraph Targets["目標"]
Browser((Browser))
Phone((Android / iOS))
Desktop((Desktop OS))
Hos((Harmony OS))
end
Nat -->|API call| Plan
Plan -->|atomic action| Loop
Loop -->|screenshot| Vlm
Vlm -->|bbox + action| Loop
Loop --> Cache
Loop --> Report
Loop -->|execute action| Web
Loop --> Adb
Loop --> Wda
Loop --> Pc
Loop --> Hm
Web --> Browser
Adb --> Phone
Wda --> Phone
Pc --> Desktop
Hm --> Hos
classDef core fill:#fff3e0,stroke:#f57c00
classDef vlm fill:#e8f5e9,stroke:#2e7d32
class Plan,Loop,Cache core
class Vlm vlm
3.3 三種 API 風格
A. Interaction API(互動)
1await agent.aiAction('click the search button, type "midscene", press Enter');
2await agent.aiTap('the login button');
3await agent.aiInput('username', 'foo@bar.com');
4await agent.aiScroll('down', 500);
5await agent.aiHover('the help icon');
B. Data Extraction API(資料擷取)
1const data = await agent.aiQuery({
2 title: 'string', // 從畫面 / DOM 抽出 title
3 price: 'number',
4 in_stock: 'boolean',
5});
6
7const list = await agent.aiQuery(
8 'array of product objects with name, price, image_url'
9);
C. Utility API(工具)
1await agent.aiAssert('the cart shows 3 items'); // 失敗會 throw
2await agent.aiWaitFor('the loading spinner is gone', { timeoutMs: 30000 });
3const loc = await agent.aiLocate('the save button');// 不點,只回 bbox
3.4 兩種輸入:YAML vs SDK
YAML(無需 build / 適合 CI):
1# midscene.yaml
2target:
3 url: https://github.com
4
5tasks:
6 - name: Search midscene
7 flow:
8 - ai: input "midscene" in search box, press Enter
9 - aiAssert: the first result is web-infra-dev/midscene
10 - aiQuery:
11 structure:
12 star_count: number
1midscene midscene.yaml
SDK(程式化、可組合複雜邏輯):見 §4.1。
4. Helper Scripts 詳細用法
4.1 Playwright 整合
1import { test, expect } from '@playwright/test';
2import { PlaywrightAgent } from '@midscene/web/playwright';
3
4test('login flow', async ({ page }) => {
5 await page.goto('https://example.com/login');
6 const agent = new PlaywrightAgent(page);
7
8 await agent.aiAction(`
9 1. type "user@example.com" in email field
10 2. type "secret" in password field
11 3. click the Login button
12 `);
13
14 await agent.aiAssert('the page shows "Welcome, user"');
15});
4.2 Puppeteer 整合
1import puppeteer from 'puppeteer';
2import { PuppeteerAgent } from '@midscene/web/puppeteer';
3
4const browser = await puppeteer.launch();
5const page = await browser.newPage();
6const agent = new PuppeteerAgent(page);
7
8await page.goto('https://amazon.com');
9await agent.aiAction('search for "midscene book"');
10const result = await agent.aiQuery({
11 first_title: 'string',
12 first_price: 'number',
13});
14console.log(result);
4.3 Bridge Mode(控制現有瀏覽器)
不啟動新 browser,直接 attach 到使用者既有 Chrome(已登入狀態):
1import { BridgeAgent } from '@midscene/web/bridge';
2
3const agent = new BridgeAgent();
4await agent.connect(); // 連到 Chrome Extension 上的 bridge
5await agent.aiAction('open Gmail, search for invoices from this month');
對 LLM agent 需要操作「已登入帳號」場景特別有用。
4.4 Android(adb)
1import { AndroidAgent } from '@midscene/android';
2
3const agent = new AndroidAgent({ deviceId: 'auto' }); // 第一個 adb device
4await agent.aiAction('open the Calculator app, calculate 7 × 8');
5const result = await agent.aiQuery({ display: 'string' });
6console.log(result.display); // "56"
4.5 iOS(WebDriverAgent)
1# 先啟動 WDA
2xcodebuild -project WebDriverAgent.xcodeproj \
3 -scheme WebDriverAgentRunner -destination "id=$UDID" test
1import { IOSAgent } from '@midscene/ios';
2
3const agent = new IOSAgent({ wdaUrl: 'http://localhost:8100' });
4await agent.aiAction('open Safari, navigate to midscenejs.com');
4.6 CLI 模式
1# YAML 跑單一檔
2midscene run midscene.yaml
3
4# 整 directory
5midscene run ./tests/
6
7# 啟 web UI playground
8midscene playground
9
10# Android playground
11midscene-android-playground
12
13# iOS playground
14midscene-ios-playground
4.7 MCP 整合
把 Midscene 作為 MCP server,給 Claude / GPT 等上層 agent 使用:
1# 啟動 MCP server
2midscene-mcp --port 3000
claude_code/mcp.json:
1{
2 "mcpServers": {
3 "midscene": {
4 "command": "midscene-mcp",
5 "args": ["--target", "web"]
6 }
7 }
8}
Claude / Claude Code 看到 midscene_aiAction / midscene_aiQuery / midscene_aiAssert 等工具。
4.8 視覺化回放(report)
每次 run 後自動生成:
1midscene run midscene.yaml
2# → midscene-report/<timestamp>/index.html
3
4open midscene-report/<timestamp>/index.html
含每步 screenshot、VLM 回應、bbox 標記、執行時間。debug 必備。
4.9 Caching mode(節省 token)
1const agent = new PlaywrightAgent(page, {
2 cache: { enable: true, key: 'github-search-test' },
3});
第一次 run 記錄 element bbox;之後相同腳本直接 replay,不再 call VLM → 速度 50× 快、token 0。當 UI 改了會 fallback 重新 plan。
5. 應用場景
| 場景 | 用法 | 重點 |
|---|---|---|
| E2E 自動測試(QA) | Playwright + Midscene | 自然語言、不依賴 selector、QA 易學 |
| 跨團隊 BDD | YAML 腳本 | 產品 / 設計可寫 |
| Mobile 自動化 | Android / iOS agent | adb / WDA 一條鞭 |
| 零代碼快速驗證 | Chrome Extension | 不寫 code,當下試 |
| AI agent 操作 GUI | MCP server | Claude / GPT 接過去 |
| Canvas / 遊戲 UI 自動化 | 純視覺路線 | DOM-less 也能跑 |
| 跨平台 regression test | 同腳本跑 4 平台 | 一次寫,多平台跑 |
| 互動錄製 → 自動產 YAML | recorder + recorder-form | 從手動操作生成測試 |
| Visual diff testing | aiAssert + screenshot | 「畫面看起來對嗎」自然語言斷言 |
| 內部 admin 工具自動化 | Bridge mode | 已登入 Chrome 接過去 |
6. 資安掃描報告
對 packages/*/src/*.ts 跑 grep -nE 'eval|new Function|child_process|exec|password|api_key|secret|token':
🔴 高風險
無。沒有 eval() / new Function() 在主路徑;無 hard-coded secret。
🟡 中風險 / 須留意
| 位置 | 模式 | 風險 | 建議 |
|---|---|---|---|
packages/android/src/scrcpy-manager.ts / packages/android/src/device.ts | child_process.execFile + spawn | 用 adb / scrcpy 控制 Android — 標準需求 | 用 execFile(不是 exec)就已避免 shell injection;OK |
packages/ios/src/utils.ts | child_process.exec | iOS 控制(xcrun simctl 等) | 確認 input args 來源(不接受任意外部字串) |
packages/computer/src/*.ts + xvfb.ts | execSync + spawn | 啟 Xvfb / VNC / RDP 視窗 | 標準需求 |
packages/harmony/src/hdc.ts | execFile | Harmony OS 控制 | OK |
packages/web-integration/src/cdp-proxy-manager.ts | spawn | Chrome DevTools Protocol proxy | OK |
packages/web-integration/src/mcp-tools-puppeteer.ts:42 | --password-store=basic | 故意 disable Chromium real keyring(避免 prompt) | 文件化好,OK |
packages/computer/src/mcp-tools.ts:50-54 | RDP password schema | 明確要求 env var / secrets manager | 良好設計 |
packages/recorder/src/recorder.ts:326 | target.type !== 'password' ? target.value : '*****' | password input 自動 redact | 良好設計 |
🟢 低風險 / 良好設計
- AGENTS.md 明示 design rules:error 要 throw 不要回 blank value
execFile偏好 vsexec:避免 shell metachar injection- password redaction 在 recorder 層做:trace zip 內不會有明文密碼
--password-store=basic:避免 Chromium 跳 keyring 系統 dialog(CI 環境必要)- MCP tool schema 主動文件化 secrets handling:RDP password 要 env var
- monorepo 用 biome(取代 ESLint + Prettier):linter 速度快、規則一致
- pnpm-only:lock 嚴格、避免 phantom dependency
VLM API 安全注意
- VLM API key 寫在 env var(
OPENAI_API_KEY/MIDSCENE_MODEL_BASE_URL),不要寫在 yaml / config - screenshot 會送給 VLM provider:若畫面含敏感資料(密碼 / 帳單 / 醫療),確認 provider DPA(OpenAI / Anthropic / Google 都有 enterprise tier)
- 自架 UI-TARS 是 air-gapped 場景首選(敏感資料不出網)
結論
🟢 整體低風險,code quality 是 ByteDance 開源項目典型水平(高)。主要建議:
- screenshot 內容隱私:敏感場景用 self-host UI-TARS 或 enterprise tier
- API key 走 env var 或 secrets manager,不寫 yaml
- CI 環境用
--password-store=basic(避開 keyring dialog)— 已內建 - recorder trace zip 預設已 redact password — 直接用即可
7. FAQ
Q1: 為什麼一定要 pnpm?npm / yarn 不行嗎? A: monorepo 用 pnpm workspace + Nx 才能正確處理 27 個 package 的內部相依。npm hoisting 會造成 phantom dependency。AGENTS.md 明示「pnpm only」。
Q2: 純視覺路線(v1.8+)會比 DOM 模式慢嗎?
A: action 部分反而省 token / 加速(不送 DOM);但對「擷取結構化資料 from HTML 表格」這種 DOM 任務,可以 opt-in 把 DOM 包進來(aiQuery 支援)。
Q3: VLM 不穩定怎辦?
A: 三條 mitigation:(a) caching mode 把 bbox replay;(b) aiLocate 拿到 bbox 後手動 verify;(c) aiAssert + aiWaitFor 做 sanity check。CI 環境再加 retry。
Q4: 多少 token per step? A: 一張 1080×1920 screenshot ~ 1000-2000 vision token + ~ 200 text token。GPT-4o 算下來每步 < $0.005;UI-TARS self-host 0 USD。一個 50-step E2E test ~ $0.25 / run。caching mode 第二次 run ~ $0.
Q5: Android 真的不需要 root? A: 不需要。adb + scrcpy 是 USB 連線標準介面,授權 adb debug 即可。iOS 需要 WebDriverAgent(須 Xcode 簽 dev cert)。
Q6: Bridge mode 安全嗎? A: Bridge mode 是 Chrome Extension 對外暴露 WebSocket,預設只 localhost。不要對外開放(理論可控你的瀏覽器 = 接管你所有登入帳號)。
Q7: 跟 Browser Use / Steel.dev 比? A: Browser-use 偏 Python;Steel 偏商業託管;Midscene 強在 (a) TypeScript 生態 (b) Mobile 支援 (c) 純視覺對 canvas 友善 (d) MCP-first 設計。技術選擇看你既有 stack。
Q8: VLM 認錯按鈕 / 點錯怎辦?
A: report HTML 看回放,找到 misclassification step,補一句具體 hint:「the blue button labeled ‘Save’ at the top right」。或 fallback 用 aiTap + locator 描述更精確的 region。
8. 進階技巧
8.1 自定義 system prompt
1const agent = new PlaywrightAgent(page, {
2 systemPrompt: `You are testing an internal CRM. The user names are pseudonymized.`,
3});
8.2 多步 plan 的 step-by-step 控制
1const plan = await agent.aiPlan('複雜任務:在 Gmail 找這個月的發票並下載');
2// plan = { steps: [...] },可預覽再 execute
3for (const step of plan.steps) {
4 await agent.executeStep(step);
5 console.log(`✅ ${step.description}`);
6}
8.3 自架 UI-TARS + vLLM batching
1python -m vllm.entrypoints.openai.api_server \
2 --model ByteDance-Seed/UI-TARS-1.5-7B \
3 --tensor-parallel-size 2 \
4 --max-num-seqs 16 \
5 --gpu-memory-utilization 0.9
對多測試並發 batching 4-16 條,throughput 提升 5-10×。
8.4 visual report E2E pipeline
1# 每次 PR run
2pnpm test:ai
3# → 自動產 midscene-report/<timestamp>/
4# → upload 到 S3 / Vercel preview
5# → PR 留言貼連結
8.5 recorder → YAML 自動生成
1midscene-recorder
2# 開瀏覽器 → 手動操作 → 結束錄製
3# → 自動生成 midscene.yaml(每步 ai 動作 + 自動推斷 assertion)
8.6 evaluation framework
1cd packages/evaluation
2pnpm run eval -- --model qwen-vl-max --tasks all
3# → 跑內建的 benchmark task suite,輸出 success rate / cost / latency
對「該換到哪個 VLM」決策有用。
8.7 Customize MCP tool list
1// midscene.config.json
2{
3 "mcp": {
4 "tools": ["aiTap", "aiInput", "aiQuery"],
5 "exclude": ["aiAction"] // 完整 aiAction 太強,限定 atomic tools
6 }
7}
對 LLM agent 過度自由的場景做 sandbox。
9. 整合進其他工作流
9.1 與 Playwright Test 整合
直接:
1import { test } from '@playwright/test';
2import { PlaywrightAgent } from '@midscene/web/playwright';
3// 其他 fixture / hooks 與原 Playwright 完全相容
9.2 Claude Code MCP
1// .mcp.json
2{
3 "mcpServers": {
4 "midscene-web": { "command": "midscene-mcp", "args": ["--target", "web"] },
5 "midscene-android": { "command": "midscene-android-mcp" }
6 }
7}
Claude 看到 midscene_aiAction 等 tool,可在對話中操作 UI。
9.3 CI/CD(GitHub Actions)
1- name: Setup
2 uses: pnpm/action-setup@v3
3 with:
4 version: 9
5- run: pnpm install
6- name: Midscene tests
7 env:
8 OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
9 MIDSCENE_MODEL_NAME: gpt-4o
10 MIDSCENE_MODEL_BASE_URL: https://api.openai.com/v1
11 run: pnpm run e2e
12- uses: actions/upload-artifact@v4
13 with:
14 name: midscene-report
15 path: midscene-report/
9.4 Rsbuild / Rspack 同團隊整合
Midscene、Rsbuild、Rspack、Rslib 都是 ByteDance web-infra-dev 出品;版本互相對齊。專案用 Rspack 跑 build + Midscene 跑 E2E,整套都有人維護。
9.5 自家研究 pipeline 整合 checklist
- VLM 選型:production 用 cloud API(穩定);敏感 / 大量 / 預算緊用 self-host UI-TARS
- caching 預設開:在 stable test 上省 90 % token
- report 自動上傳:報告含 screenshot,PR review 必備
- monorepo 整合:用 Nx 把 midscene test target 與 main build 串
- secrets 走 .env / secrets manager,不寫 yaml
- MCP server 限定 localhost,不對外暴露
10. 重點摘要 Checklist
- Node ≥ 18.19 + pnpm ≥ 9.3(必須 pnpm)
- VLM 預備好(OpenAI / Doubao / Gemini / 自架 UI-TARS)
- 三種 install path:既有 PW/Puppeteer 專案 / Chrome Extension / mobile CLI
- 三種 API:aiAction (interaction) / aiQuery (data) / aiAssert + aiLocate (utility)
- 兩種輸入:YAML(CI 友善)/ SDK(程式化)
- v1.8+ 純視覺路線 —
<canvas>/ 自製 widget 都可控 - CI 環境必設 caching 省 90 % token
- report HTML 是 debug 神器
- MCP server 整合 Claude / GPT
- 多平台 Android / iOS / Desktop / Harmony 一條鞭
- 敏感資料 → self-host UI-TARS
- VLM key 走 env var
11. 進一步閱讀
| 主題 | 連結 |
|---|---|
| 官網 | https://midscenejs.com |
| API reference | https://midscenejs.com/api |
| Sample projects | https://github.com/web-infra-dev/midscene-example |
| Model strategy | https://midscenejs.com/model-strategy |
| Bridge mode | https://midscenejs.com/bridge-mode |
| MCP docs | https://midscenejs.com/mcp |
| Caching | https://midscenejs.com/caching |
| Chrome Extension | https://midscenejs.com/quick-experience |
| Android getting started | https://midscenejs.com/android-getting-started |
| iOS getting started | https://midscenejs.com/ios-getting-started |
| UI-TARS(self-host model) | https://github.com/bytedance/ui-tars |
| Qwen-VL | https://github.com/QwenLM/Qwen-VL |
| Discord | https://discord.gg/2JyBHxszE4 |
| https://x.com/midscene_ai | |
| AGENTS.md(內部 agent rules) | repo 根目錄 |
Generated 2026-05-23 by gh-tutorial-qd skill — paired with inbox/2026-05-23-github-web-infra-dev-midscene.md.
Comments