需先配置模型 API 才能运行,README 未给出默认模型;Web 场景需已有 Playwright 的 page 对象;报告、缓存和日志统一写入 midscene_run/ 目录,CI 中需单独归档
midscene
web-infra-devMIT活跃维护用自然语言描述操作步骤就能完成端到端测试,让 AI 像人一样看懂界面并驱动浏览器或手机执行验证。
See interfaces like a human. E2E testing in natural language.
npm i @midscene/web
import { PlaywrightAgent } from '@midscene/web/playwright';README 未说明本地显存或 GPU 要求,模型通过 API 调用,支持 GPT、Qwen、Doubao Seed、DeepSeek、Gemini、Kimi 及可自托管开源模型
用自然语言描述 UI 步骤做端到端测试的 AI 视觉自动化框架,覆盖 Web、移动端和桌面
用自然语言描述操作步骤就能完成端到端测试,让 AI 像人一样看懂界面并驱动浏览器或手机执行验证。
核心能力
- 基于截图定位元素并执行点击、输入、滚动
- 用 aiAssert 校验颜色、选中态、布局等视觉结果
- 同一套 Agent API 跨 Web、Android、iOS、鸿蒙、桌面
- Midscene Test 用 YAML 写用例、TypeScript Node 复用业务能力
- 步骤级报告含截图、元素位置与 AI 决策过程
容易踩的坑
- v1.17.7最新正式版2026-11-06 · 2026-11-06 05:29 UTC
English
v1.17.7
Changes
Features 🎉
- feat(test): unify runtime artifact directories (PR3) by @xiong35 in https://github.com/web-infra-dev/midscene/pull/3338
CI & Chore ⚙️
- chore(core): support configurable locate prompt order and grouping by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3348
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.6...v1.17.7
中文
v1.17.7
完整变更
新特性 🎉
- feat(test): unify runtime artifact directories (PR3) by @xiong35 in https://github.com/web-infra-dev/midscene/pull/3338
CI 与维护 ⚙️
- chore(core): support configurable locate prompt order and grouping by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3348
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.6...v1.17.7
- v1.17.62026-11-05 · 2026-11-05 08:34 UTC
查看更新说明
English
v1.17.6
Changes
Features 🎉
- feat(badge): localize and redesign badge homepage by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3341
- feat(test): add summary badges and improve badge site metadata by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3342
- feat(web-integration): add CLI browser tab management by @quanru in https://github.com/web-infra-dev/midscene/pull/3302
- feat(core): expose public SIWC authorization entry by @quanru in https://github.com/web-infra-dev/midscene/pull/3349
Fixes 🐞
- fix(workflow): use dedicated badge deployment token by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3340
- fix(core): clarify external abort errors by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3320
- fix(core): respect model proxy settings in SIWC requests by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3330
- fix(core): preserve arrays in aiQuery JSON responses by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3345
- fix(core): locate Jev targets without a presence check by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3347
Performance 🚀
- perf(workflow): speed up CI with bounded AI concurrency by @quanru in https://github.com/web-infra-dev/midscene/pull/3333
Testing 🧪
- test(report): run e2e files with isolated contexts at concurrency 3 by @await-ovo in https://github.com/web-infra-dev/midscene/pull/3346
CI & Chore ⚙️
- chore(badge): add badge service with GitHub Actions deployment by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3339
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.5...v1.17.6
中文
v1.17.6
完整变更
新特性 🎉
- feat(badge): localize and redesign badge homepage by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3341
- feat(test): add summary badges and improve badge site metadata by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3342
- feat(web-integration): add CLI browser tab management by @quanru in https://github.com/web-infra-dev/midscene/pull/3302
- feat(core): expose public SIWC authorization entry by @quanru in https://github.com/web-infra-dev/midscene/pull/3349
问题修复 🐞
- fix(workflow): use dedicated badge deployment token by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3340
- fix(core): clarify external abort errors by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3320
- fix(core): respect model proxy settings in SIWC requests by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3330
- fix(core): preserve arrays in aiQuery JSON responses by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3345
- fix(core): locate Jev targets without a presence check by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3347
性能优化 🚀
- perf(workflow): speed up CI with bounded AI concurrency by @quanru in https://github.com/web-infra-dev/midscene/pull/3333
测试 🧪
- test(report): run e2e files with isolated contexts at concurrency 3 by @await-ovo in https://github.com/web-infra-dev/midscene/pull/3346
CI 与维护 ⚙️
- chore(badge): add badge service with GitHub Actions deployment by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3339
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.5...v1.17.6
- v1.17.52026-11-02 · 2026-11-02 13:43 UTC
查看更新说明
English
v1.17.5
Changes
Features 🎉
- feat(test): host Agent records in unified reports (PR2) by @xiong35 in https://github.com/web-infra-dev/midscene/pull/3326
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.4...v1.17.5
中文
v1.17.5
完整变更
新特性 🎉
- feat(test): host Agent records in unified reports (PR2) by @xiong35 in https://github.com/web-infra-dev/midscene/pull/3326
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.4...v1.17.5
- v1.17.32026-10-29 · 2026-10-29 08:04 UTC
查看更新说明
English
v1.17.3
Changes
Features 🎉
- feat(core): add ant-ling model adapter by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3315
- feat(report): add directory report artifact foundation (PR1) by @xiong35 in https://github.com/web-infra-dev/midscene/pull/3312
Refactors ♻️
- refactor(core): rename supportedTaskTypes to allowedTaskTypes by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3314
Documentation 📖
- docs(site): clarify test entry points by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3310
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.2...v1.17.3
中文
v1.17.3
完整变更
新特性 🎉
- feat(core): add ant-ling model adapter by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3315
- feat(report): add directory report artifact foundation (PR1) by @xiong35 in https://github.com/web-infra-dev/midscene/pull/3312
重构 ♻️
- refactor(core): rename supportedTaskTypes to allowedTaskTypes by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3314
文档 📖
- docs(site): clarify test entry points by @yuyutaotao in https://github.com/web-infra-dev/midscene/pull/3310
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.2...v1.17.3
- v1.17.22026-10-28 · 2026-10-28 03:10 UTC
查看更新说明
English
v1.17.2
Changes
Features 🎉
- feat(core): support custom endpoints for System One models by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3301
Fixes 🐞
- fix(core): allow Jev as default model for supported tasks by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3308
- fix(core): support Gemini 4 Argon by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3309
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.1...v1.17.2
中文
v1.17.2
完整变更
新特性 🎉
- feat(core): support custom endpoints for System One models by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3301
问题修复 🐞
- fix(core): allow Jev as default model for supported tasks by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3308
- fix(core): support Gemini 4 Argon by @EAGzzyCSL in https://github.com/web-infra-dev/midscene/pull/3309
Full Changelog: https://github.com/web-infra-dev/midscene/compare/v1.17.1...v1.17.2
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Write a test in natural language
Midscene.js brings AI vision to E2E testing. Describe UI steps and expected results in natural language, then use the visual GUI Agent to carry them out and verify what users see. Organize tests with Midscene Test, or integrate the Agent APIs into your existing testing framework.
YAML test cases with Midscene Test
After creating a Midscene Test project and configuring a model and the Web runtime, write a case like this. Replace the example URL with your app's address:
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 in your existing tests
You can also use the Agent directly in your existing tests. Configure a model and open your app in a Playwright page, then describe the same steps in code:
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');
For mobile and desktop apps, use the platform Agent with Vitest. Open the generated HTML report to inspect screenshots, element locations, the AI decision process, and action and assertion results.
👁️ See, act, and verify like a human
E2E testing verifies complete workflows from the user's perspective, so Midscene tests the way a user does: observe the screen, act on what you see, and verify the visible result.
Locate and act from screenshots
Midscene locates elements by their appearance and position, then clicks, types, or scrolls to carry out your instructions. You can target icon-only buttons, custom controls, <canvas>, and elements inside cross-origin iframes without maintaining selectors or adding semantic annotations.
Verify what users see
Describe the expected appearance in natural language to check colors, selection highlights, layout, and visual feedback — including content drawn on <canvas> or displayed in native apps.
await agent.aiAssert('The selected plan has a blue border and a checkmark');
await agent.aiAssert('The error message is visible below the email field');
🌐 One API, across platforms
Visual localization does not depend on the UI rendering stack, so the same Agent APIs work on every platform:
| 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 |
📊 Models, cost, and benchmarks
Choose models for your needs and budget
Screenshot-based UI actions avoid sending large DOM trees to the model. In the reported AppControlBench run, Midscene with Doubao Seed 2.1 Turbo passed 58 of 60 tasks with $0.59 in total model cost. The report provides per-task costs and comparisons across models.
Midscene supports GPT, Qwen, Doubao Seed, DeepSeek, Gemini, Kimi, and more, including open-source options you can self-host. See Model Selection Guide to choose a model and Model Configuration to set it up.
Benchmarks
| Benchmark | Pass@1 | Model used in the reported run |
|---|---|---|
| AndroidWorld | 93.1% | Gemini-3.5-Flash |
| MobileWorld | 78.6% | Gemini-3.6-Flash |
| AppControlBench | 96.7% | Doubao Seed 2.1 Turbo |
Each report includes the run configuration and task results; see AndroidWorld's report for its environment and validator adjustments. Explore cross-platform showcases, from web form validation to mobile workflows and community-built in-vehicle testing.
🧩 Midscene Test: a natural-language E2E testing framework
Midscene Test (@midscene/test) is a natural-language E2E testing framework. Describe actions and expectations in YAML, and keep logic that needs precise control in TypeScript.
Test cases maintained by people and AI
- Describe test cases in YAML. Combine UI actions, assertions, and business operations to express the flow and expected results.
- Reuse business capabilities through TypeScript Nodes. Wrap data preparation, API calls, and cleanup in Nodes that different cases can share. A refund test can prepare an order through an API, request a refund through the UI, and verify the result in one workflow.
- Generate a Node Spec for developers and AI agents. Export registered Nodes and their inputs as Markdown, so both can write cases without reading TypeScript.
Test framework capabilities
- Lifecycle hooks and cleanup:
setup,fileSetup,beforeAll, andbeforeEachwith matching cleanup hooks; cleanup still runs after timeouts or Ctrl+C. - Retries and timeouts: case retries, step timeouts,
continue-on-error, andbail. - Concurrency and isolation:
maxConcurrentFiles, withfileSetupgiving each file its own page, Agent, or device. - Step-level reports: screenshots, inputs, outputs, and Agent replay for every step,
#runner-step=last-errordeep links, andsummary.jsonfor scripts and AI agents.
Start with Create and use test projects, then learn how to Develop custom Nodes and control lifecycle and concurrency.
Reports, Test results, caches and logs are saved in midscene_run/. See artifact directories for configuration and CI archiving.
🚀 Get started
- Write YAML test cases — create a Midscene Test project.
- Add visual capabilities to existing tests — Playwright for web apps, Vitest for mobile and desktop apps.
- Try it before writing tests — the Chrome extension or a Playground for mobile or desktop.
- Run standalone automation scripts — the JavaScript SDK.
- Let your AI agent operate the UI — Midscene Skills.
📄 Resources
- Documentation: https://midscenejs.com
- Sample projects: midscene-example
- API reference: https://midscenejs.com/reference/#common
🤝 Community
🌟 Awesome Midscene
Community projects that extend Midscene.js capabilities:
- midscene-ios - iOS Mirror automation support for Midscene
- midscene-pc - PC operation device for Windows, macOS, and Linux
- midscene-pc-docker - Docker image with Midscene-PC server pre-installed
- Midscene-Python - Python SDK for Midscene automation
- midscene-java by @Master-Frank - Java SDK for Midscene automation
- midscene-java by @alstafeev - Java SDK for Midscene automation
📝 Credits
We would like to thank the following projects:
- Rsbuild and Rslib for the build tools.
- UI-TARS for the open-source agent model UI-TARS.
- Qwen-VL for the open-source multimodal model Qwen-VL.
- scrcpy and yume-chan for browser-based Android device control.
- appium-adb for its JavaScript bridge to ADB.
- appium-webdriveragent for controlling XCTest from JavaScript.
- YADB for improving text input performance.
- libnut-core for cross-platform native keyboard and mouse control.
- Puppeteer for browser automation and control.
- Playwright for browser automation, control, and testing.
📖 Citation
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}
}
⭐ Star Midscene
If Midscene is useful to you, please give it a star.
📝 License
Midscene.js is MIT licensed.