Built-in Nodes across platforms
Midscene Test refers to each callable capability in YAML test cases and lifecycle hooks as a Node.
When you register an official Agent in midscene.config.ts using createMidsceneNodes({ agentClass, getAgent }), the framework injects general AI capabilities and official built-in Nodes for the respective platform. This guide catalogs available built-in Nodes, their input structures, and common usage patterns across platforms.
This page lists standard specifications for official built-in capabilities. To inspect the effective list of available Nodes, their JSON input schemas, and custom business Nodes in your project, run pnpm exec midscene-test nodes (or pass --project <name> for multi-project repositories) to generate midscene-node-spec.md.
Node syntax overview
YAML cases support two calling styles:
- String shorthand: When a Node specifies a
stringInputKey, you can pass a single string directly: - Object mapping: When providing multiple fields or optional configuration, supply key-value pairs; for Nodes without parameters, pass
{}:
Universal Nodes
All testing targets (Web, Android, iOS, HarmonyOS, and Desktop) support core AI action and assertion Nodes.
Core AI Nodes
In typical test authoring, the most essential and recommended Nodes are:
Other atomic actions and advanced Nodes
Other atomic interaction methods available on the GUI Agent SDK (such as aiTap, aiHover, aiInput, aiKeyboardPress, aiScroll, aiDragAndDrop, etc.) can also be called directly as Nodes in YAML.
However, for test case robustness, avoid overly fine-grained step-by-step orchestration in YAML:
- Breaking a flow down into many granular clicks, focus changes, and swipes makes YAML files brittle and verbose, increasing maintenance cost when the UI layout evolves;
- Prefer
aiActto describe the user's business intent (for example, "Type mug into the search box and tap search"), allowing the visual model to plan the underlying actions adaptively.
The runtime also injects several auxiliary and advanced capabilities:
- Data extraction and queries:
aiQuery(structured data extraction),aiBoolean/aiString/aiNumber/aiAsk(interface content extraction and Q&A). - Context guidance and reporting:
setAIContext(injects domain guidance or modal dismissal rules for subsequent AI steps),recordToReport(appends custom notes or snapshots to reports). - Waiting and execution:
wait(framework-level cancellable wait with{ duration, unit }),sleep(Agent-level wait),javascript(evaluates scripts).
To inspect input parameters for these advanced Nodes, generate your project's Node Spec with pnpm exec midscene-test nodes.
Web built-in Nodes
Web project templates run on Playwright or Puppeteer and provide browser session management alongside universal capabilities:
Mobile built-in Nodes
Mobile testing targets rely on device lifecycles and physical/system keys. Midscene provides standardized system controls and platform bridges for Android, iOS, and HarmonyOS.
Android (@midscene/android)
iOS (@midscene/ios)
HarmonyOS (@midscene/harmony)
Desktop (Computer)
Desktop automation (macOS, Windows, Linux) leverages the full suite of universal Nodes:
- Use
aiAct,aiTap,aiDoubleClick, andaiRightClickto inspect and interact with native application windows, system menus, and modal dialogs. - Use
aiKeyboardPressto issue keyboard shortcuts (such as focus switching or save shortcuts). - For complex system-level setup or platform utilities, implement custom Nodes to call native shell scripts or system commands.
Next steps
- Write YAML cases: Learn workflow document structures, variable bindings, tag filtering, and lifecycle hooks.
- Develop custom Nodes: Encapsulate domain APIs, backend fixtures, and private tooling.
- Configure test projects: Manage project settings, platform drivers, and multi-project workspaces.

