For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /index.md.
  • English
  • Use the UI like a user
    Vision-driven E2E testing in natural language

    A GUI Agent and E2E testing framework for web, mobile, and desktop.

    15k+Github Stars
    MITFully open source
    #2No.2 in Github trending

    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 actually matters is recreating real user journeys to verify the user experience—not chasing code changes to patch selectors.

    Midscene drives E2E testing the way humans use UI: looking at the screen, acting on what's visible, and verifying the rendered result.

    Plan & adapt

    Reads the screen like a user and decides the next step across multi-step flows, scrolling, or unexpected popups.

    Pinpoint & act

    Locates exact (x, y) coordinates visually without DOM or selectors — including banner artwork and canvas elements.

    Verify visually

    Asserts on what users actually see on screen — content, color, layout, and state — not just whether a DOM node exists.

    Compared with selector-based E2E

    See how vision-driven execution compares with positional selectors across visual changes, unexpected popups, and non-DOM canvas UIs.

    See real-world examples
    Vision-driven Midscene
    Diff caught

    Goal "Red headphones": sees "SOLD OUT" on screen and catches the regression.

    Sale
    $79
    SAME <img> NODE
    aiAssert
    SOLD OUTNo red headphones · caught
    Traditional selector-based E2E
    False positive

    Goal "Red headphones": image swaps to "SOLD OUT", yet selector still false-passes.

    Sale
    $79
    SAME <img> NODE
    .banner > imgPASS
    SOLD OUTFalse Positive · wrong click

    Models, cost, and accuracy

    A growing set of vision models now meet the bar for production use across accuracy, speed, and cost. Midscene is not tied to any single provider—use your existing model vendor and pick what fits your workload.

    Estimate cost for your model

    Pick a model you already have access to and check its token usage and grounding cost.

    Cost calculator

    deepseek-v4.1-flash

    ≈20,164UI grounding steps / $1

    Estimated test runs
    ≈ 2,016 runs (~10 steps each)
    Estimated tokens per grounding step
    1,072 in22 out

    Input and output tokens are estimated from screenshot pixel count. Costs use published reference prices.

    Find a balanced model for your tests

    See how 35 vision models perform across accuracy, speed, and cost in our 200-case E2E grounding benchmark report.

    View benchmark report

    These public GUI Agent benchmark results show Midscene's pass rates and actual cost on real multi-step tasks. Click any card for the full report.

    Integrate with your workflow

    Use the same visual Agent in YAML with Midscene Test, or integrate it directly into existing JavaScript test suites such as Playwright Test, Rstest, or Vitest.

    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"

    Core APIs

    Mix autonomous flows, instant single actions, and read-only visual checks in the same test.

    • Autonomous goalObserves the screen, plans steps, locates targets, and adapts to popups or branches until the goal is met.
    • Precise single actionSkips multi-step planning to locate one target and run a fixed action — faster, lower token cost, and more predictable.
    • Read-only insightReads the current screenshot to assert UI state or extract structured data without triggering any interaction.

    One API, across platforms

    Visual localization reads screenshots instead of DOM trees or native UI hierarchies, so the same API works across built-in platforms and extends to any custom UI or physical device.

    Same APIawait agent.aiAct('Search for headphones')
    Screenshot → Vision → Action
    Extend to any screen or physical deviceOnly screenshots and actions over HTTP—no DOM or accessibility tree.
    • Robotic arms (DOBOT MG400)
    • Bluetooth HID (ios-airlink)
    • Car & embedded screens
    • Custom tools & live preview

    Midscene Test: A testing framework built for AI

    Beyond the GUI Agent SDK above, Midscene also provides a standalone E2E testing framework (@midscene/test). If you already use Playwright Test, Vitest, or your own scripts, you can stick with the SDK directly; if you want a dedicated framework built for AI-driven testing, you can use Midscene Test.

    It keeps test flows in clean YAML and moves deterministic business logic into reusable code modules, so humans and AI agents focus on the user journey rather than test plumbing. Get started with Midscene Test

    Interactive and business operations in one YAML file

    Each YAML step calls a Node: an AI, platform, or custom business operation. Compose them into a test case.

    cases/refund.yaml
    beforeEach:  - order.prepare: { status: paid }Business  - gotoUrl: ${shopUrl}/orders/latestBusinesscases:  - name: A paid order supports a full refund    steps:      - aiAct: Apply for a full refund and submitInteractive      - aiAssert: The page shows that the refund was submittedInteractive      - order.checkRefund: { status: refunding }BusinessafterEach:  - clearCookies: {}Business

    Separate intent from business logic, maintained by people and AI

    Wrap reusable business logic in custom Nodes. Midscene Test generates a Markdown Node Spec listing every Node and its inputs, so QA engineers and AI agents can write cases without reading TypeScript. Learn how to develop custom Nodes

    1. nodes/order.ts
      defineNode({
        name: 'order.prepare',
        description: "Create a test order",
        inputSchema: z.strictObject({
          status: z.literal('paid'),
        }),
        async execute({ input }) {
          await orders.create(input);
        },
      });
    2. midscene-node-spec.md
      ### order.prepare
      Create a test order
      - status: "paid"
    3. case.yaml
      steps:
        - order.prepare:
            status: paid

    Replay every action in visual reports

    Every run generates an interactive HTML report. Inspect the full lifecycle step tree, drill into each Agent step’s Plan, Locate, and action timings, and scrub through the screenshot timeline to replay exactly what happened on screen. Explore reporting

    Midscene.js/Overview/PassedFind headphones under $100
    10.6s28.5K tokensVisualYAML
    #3aiActPassed

    Type "headphones" in the search box and click Search

    ExecutionTime
    Plan1.82s
    Locate0.42s
    Input0.96s
    Tap0.55s
    Elapsed3.75s
    Model2.24s
    RecordPlan · 1.82s
    2s
    4s
    6s
    8s
    Midscene Shop
    Ready to search
    Wireless Headphones$89
    Add to cart

    Engineering foundation built for AI testing

    Midscene Test ships with the runtime and CI capabilities needed to run visual agents reliably at scale: multi-project orchestration, isolated concurrency, guaranteed teardown, GitHub Actions integration, and machine-readable outputs.

    Who is using Midscene

    Next steps

    To let AI coding agents operate your UI, explore Midscene Skills.