John Li

微信小程式自動化測試

開發程式設計v1.0.0
作者:John Li更新於 2026-05-11weapp-automated-testing@clawhub_eumenides-k/weapp-automated-testing
測試生成#WeChat

據 AlphaMoat 統計,截至 2026-10,微信小程式自動化測試 累計下載 10,512 次、獲 10 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 2,592 位,在「開發程式設計」分類(1,069 個)中排名第 194 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
1.1萬
星標
10
全站下載量排名
#2,592
全站前 24% · 「開發程式設計」前 19%
平台累計下載星標評論
ClawHub ↗9861-
SkillHub ↗1.1萬10—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

可啟動開發者工具、跳轉頁面、操作元素、截圖並讀取控制檯日誌。使用時要求把全部操作寫進一個使用 WeappTestRunner 的指令碼,再用一次 python 呼叫執行,而不是逐步發多次命令。

資料釋出於 2026-10-27

可以用來做什麼

  • 為一條下單流程寫端到端自動化指令碼並跑一遍。
  • 批次截圖並抓取控制檯報錯定位問題。

什麼時候用

  • 需要回歸驗證小程式的頁面跳轉與互動時。
  • 要一次性執行多步操作而不想反覆呼叫時。

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

寫一個指令碼自動走完登入到下單的流程並截圖。
幫我寫指令碼讀取控制檯日誌,定位這個頁面的報錯。

月度資料趨勢

累計下載1.1萬
60359251.1萬2026-03 · 累計下載 13372026-05 · 累計下載 29392026-07 · 累計下載 38962026-08 · 累計下載 45642026-09 · 累計下載 56912026-10 · 累計下載 1.1萬26-0326-0926-10
星標10
06112026-03 · 星標 12026-05 · 星標 92026-07 · 星標 102026-08 · 星標 102026-09 · 星標 102026-10 · 星標 1026-0326-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-101.1萬—10
2026-095691—10
2026-084564+17.1%10
2026-073896—10
2026-052939—9
2026-031337—1

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

3.3 KB · ClawHub v1.0.0
---
name: weapp-automatd-testing
description: WeChat Mini Program automation testing toolkit. Supports launching DevTools, page navigation, element interaction, screenshots, console log reading, and more. Use when the user needs to automate mini program testing, control WeChat DevTools, read console logs, or perform UI screenshot comparison.
---

# WeChat Mini Program Automation Testing

## CRITICAL: Batch Execution Rule

**ALWAYS write a single Python script that uses `WeappTestRunner` to batch ALL operations, then execute it with ONE `python` call.**
展開全部(共 102 行)

Each tool call costs ~30-60s overhead. A test with 10 individual CLI calls takes 5-15 minutes; the same 10 operations batched into one script take ~5 seconds.

### Execution pattern

1. **Plan** all operations the user needs
2. **Write** a single Python script using `WeappTestRunner`
3. **Run** with one `python` command
4. **Read** output and report results

### Example

```python
import sys
sys.path.insert(0, r"path_to_weapp-automation_skill\scripts")
from weapp_automation import AutomationConfig, WeappTestRunner

config = AutomationConfig(
    project_path=r"path_to_your_miniapp\my_mini_app",
    ws_endpoint="ws://localhost:9420"
)

runner = WeappTestRunner(config)
results = (runner
    .navigate("pages/index/index")
    .wait(2)
    .screenshot("home.png")
    .click(".category-item")
    .wait(1)
    .screenshot("after_click.png")
    .get_results())

print(runner.get_summary())
for r in results:
    print(r)
```

Save as a `.py` file and run with `python script.py`.

---

## Prerequisites

1. Install: `npm install -g miniprogram-automator`
2. Open WeChat DevTools -> Settings -> Security Settings -> Enable "Service Port"
3. Ensure the project is imported into DevTools

CLI paths:
- **macOS**: `/Applications/wechatwebdevtools.app/Contents/MacOS/cli`
- **Windows**: `C:\Program Files (x86)\Tencent\微信web开发者工具\cli.bat`

---

## WeappTestRunner Chainable Methods

| Method | Description |
|--------|-------------|
| `.navigate(page_path)` | Navigate to a page |
| `.click(selector)` | Tap an element |
| `.input(selector, text)` | Type text into an input field |
| `.screenshot(filename)` | Take a screenshot |
| `.scroll(selector, direction, distance)` | Scroll an element |
| `.get_wxml(selector)` | Extract WXML DOM structure |
| `.get_data(path)` | Read page data |
| `.wait(seconds)` | Wait for a duration |
| `.run()` | Execute all queued steps |
| `.get_results()` | Execute and return results list |
| `.get_summary()` | Return pass/fail summary dict |

---

## Other APIs

- **WeappAutomation** - Single-step API for one-off operations
- **WeappLauncher** - Launch/close WeChat DevTools
- **ConsoleReader** - Read and analyze console logs
- **PerformanceMonitor** - Collect performance metrics
- **TestScenarios** - Pre-built test scenario templates (smoke, navigation, form, UI regression, user journey)

For detailed usage, parameters, and examples of all APIs, see [references/api_reference.md](references/api_reference.md).

---

## Script Inventory

| Script | Purpose |
|--------|---------|
| `scripts/weapp_launcher.py` | Launch/close WeChat DevTools |
| `scripts/weapp_automation.py` | Core automation engine (batch + single-step) |
| `scripts/console_reader.py` | Console log reading and analysis |
| `scripts/test_scenarios.py` | Pre-defined test scenario templates |

「開發程式設計」分類下的熱門技能

程式設計大神.Skill開發程式設計

【全棧能力】程式設計大神.Skill:面向複雜真實專案的高階全棧程式設計助手。不止生成程式碼,而是從一句目標接手陌生程式碼庫,拆解需求、補齊實現、追到根因、完成重構、聯調前後端,並把結果推進到能執行、能驗證、能交付。覆蓋 Web、後端、指令碼、iOS、安卓、鴻蒙 ArkUI、微信小程式及其他技術棧,支援中英文工程、疑難 Bug、跨模組任務和長任務續做;用構建、日誌、真實入口、裝置或介面證據說明結果。僅問概念時直接回答,要求落地時持續推進到驗收或明確阻塞。

↓ 1125.9萬★ 82u_42bbb65f
程式設計專家Pro.Skill開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 626.9萬★ 32user_47d655f0
程式設計專家.Skill開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 600.7萬★ 378user_741dc82b
dev-expert開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 528.1萬★ 32user_814dbe54
dev-expert-pro開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 104.7萬★ -user_814dbe54
程式設計專家 Pro開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 98.2萬★ 1user_28275a78
程式設計專家.Skill開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 70.1萬★ 6user_613b33ea
Github開發程式設計

用 gh 命令列工具檢視 GitHub 上的 PR 檢查、工作流執行與 API 查詢的技能。

↓ 48萬★ 714Peter Steinberger

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。