
Use the UI like a user.
Vision-driven E2E testing & GUI Agent for web, mobile, and desktop.
Website · English / 简体中文
Recreate user journeys to verify real experience
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:

Models and cost
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.
Integrate with your workflow
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');
Core APIs
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 |
Midscene Test: a testing framework built for AI
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:
- YAML + TypeScript Nodes: keep test intent in YAML and encapsulate deterministic business logic (test data, APIs, cleanup) as reusable TypeScript Nodes.
- Auto-generated Node Spec: export registered Nodes and input schemas to Markdown so engineers and AI agents can author cases without reading TypeScript.
- Execution & isolation: multi-project orchestration (
--project, tags), maxConcurrentFiles concurrency with per-file fileSetup isolation, reverse-order lifecycle cleanup (even on timeout or Ctrl+C), and retries.
- Visual reports & CI: interactive HTML replay (
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
Get started
Resources
Awesome Midscene
Projects that extend Midscene.js capabilities:
- midscene-test-everything - Real-world hardware and platform integrations built on
@midscene/connect, including a DOBOT MG400 robot arm for physical touchscreens and Bluetooth HID control (ios-airlink) for physical iPhones
- 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:
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 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.
评论