- Автор
- web-infra-dev
- Размер
- 916.6 MB
- Звёзды
- 15.8K
- Обновлён
- КоммитNov 18Релизv1.18.1Nov 17
- Возраст
- 2 г
- Коммиты · 90 дней
README проекта с github.com/web-infra-dev/midscene. Одним файлом markdown: README.md.
Use the UI like a user.
Vision-driven E2E testing & GUI Agent for web, mobile, and desktop.
Real users interact with what's on the screen, not your DOM. As AI writes and refactors code faster than ever, what matters most in E2E testing is recreating real user journeys to verify the actual experience—yet most AI testing tools and Playwright MCP still translate intent into selector scripts, stuck in DOM replay.
Midscene skips script translation, using vision models to look at the screen, act on what's visible, and verify the rendered result directly:

Midscene is model-agnostic — bring Doubao Seed, Qwen, DeepSeek, Gemini, GPT, Kimi, MiMo, or any OpenAI-compatible / self-hosted endpoint (selection · setup). Because screenshot-based actions avoid sending large DOM trees, everyday E2E runs cost fractions of a cent per step (1280 × 720 / 720 × 1280 screenshots):
| Model | UI grounding steps / $1 | Est. test runs / $1 (10 steps/run) |
|---|---|---|
deepseek-v4.1-flash |
≈ 20,164 | ≈ 2,016 |
gpt-6-luna |
≈ 4,901 | ≈ 490 |
seed-2.0-mini |
≈ 4,640 | ≈ 464 |
qwen3.8-flash |
≈ 4,141 | ≈ 414 |
gemini-3.8-flash |
≈ 729 | ≈ 72 |
Estimated from screenshot pixel count and published reference prices. See the full 35-model model comparison report for accuracy, speed, and cost across real E2E cases.
Use the same visual Agent in YAML with Midscene Test, or directly in Playwright Test, Rstest, or Vitest:
YAML (Midscene Test)
beforeEach:
- gotoUrl: https://your-shop.example
cases:
- name: Find headphones under $100
steps:
- aiAct: Search for headphones and filter the results to prices under $100
- aiWaitFor: The filtered search results are visible
- aiAssert: There are products in the search results, and each costs less than $100
JavaScript (Playwright / Rstest / Vitest)
import { PlaywrightAgent } from '@midscene/web/playwright';
const agent = new PlaywrightAgent(page);
await agent.aiAct('Search for headphones and filter the results to prices under $100');
await agent.aiWaitFor('The filtered search results are visible');
await agent.aiAssert('There are products in the search results, and each costs less than $100');
Mix three levels of control in the same test (API reference):
| Category | APIs | Use case |
|---|---|---|
| Autonomous goal | aiAct |
Multi-step flows with scrolling, branches, or popups |
| Precise single action | aiTap, aiInput, aiHover, aiScroll, aiKeyboardPress |
Single fixed action — faster, lower cost, more predictable |
| Read-only insight | aiAssert, aiQuery, aiWaitFor, aiBoolean, aiString, aiNumber |
Visual assertions and structured data extraction |
| Platform | Integration |
|---|---|
| Web | Playwright, Puppeteer, or desktop Chrome |
| Android | Devices and emulators through ADB |
| iOS | Devices and simulators through WebDriverAgent |
| HarmonyOS | HarmonyOS NEXT through HDC |
| Desktop | macOS, Windows, and Linux, with remote RDP support |
| Custom interfaces | Provide screenshots and action capabilities |
Beyond the GUI Agent SDK, Midscene provides a standalone E2E testing framework (@midscene/test). Stick with the SDK if you already have Playwright or Vitest suites; use Midscene Test if you want a dedicated AI-native test project:
--project, tags), maxConcurrentFiles concurrency with per-file fileSetup isolation, reverse-order lifecycle cleanup (even on timeout or Ctrl+C), and retries.Plan, Locate, screenshots), official midscene-action with #runner-step=last-error deep links, and summary.json / result.md outputs in midscene_run/.Docs: Create a test project · Develop custom Nodes · Lifecycle and concurrency · Artifacts
Projects that extend Midscene.js capabilities:
@midscene/connect, including a DOBOT MG400 robot arm for physical touchscreens and Bluetooth HID control (ios-airlink) for physical iPhonesWe would like to thank the following projects:
If you use Midscene.js in your research or project, please cite:
@software{Midscene.js,
author = {Xiao Zhou, Tao Yu, YiBing Lin},
title = {Midscene.js: GUI Agent for E2E Testing.},
year = {2025},
publisher = {GitHub},
url = {https://github.com/web-infra-dev/midscene}
}
If Midscene is useful to you, please give it a star.
Midscene.js code is MIT licensed. The separately published @midscene/benchmark-grounding test set documents the licenses declared by its direct sources. See the test set license and attribution.