Skip to content

自动生成

本页由 pnpm nodes 从 midscene-node-spec.android.md 生成,不要手改。改了 nodes/ 下的自定义节点后重新生成即可。

Midscene Test Node Spec ​

This document describes the Nodes available in YAML test files (.yaml or .yml) for the Midscene Test framework (@midscene/test). It lists the Nodes registered by the current Test Project, their inputs, and how to call them in test steps and lifecycle hooks.

Learn about the framework and YAML test authoring:

Available Nodes ​

This table lists all available Nodes. See Node Details below for each Node's usage and input schema.

NodeDescription
aiActPerform a natural-language task with a Midscene UI Agent.
aiAssertAssert a natural-language condition with a Midscene UI Agent.
actionCall a platform or custom action. Its ActionSpace schema validates params when the action executes.
aiAskRun aiAsk with a Midscene UI Agent and store its value.
aiBooleanRun aiBoolean with a Midscene UI Agent and store its value.
aiClearInputLocate an input element and clear its value with a Midscene UI Agent.
aiDoubleClickLocate and double-click an element with a Midscene UI Agent.
aiDragAndDropLocate source and destination elements, then drag the source to the destination.
aiHoverLocate and hover over an element with a Midscene UI Agent.
aiInputLocate an input element and enter a value with a Midscene UI Agent.
aiKeyboardPressPress a key or key combination, optionally targeting a located element.
aiLocateLocate an element from a natural-language description and store the result.
aiLongPressLocate and long-press an element with a Midscene UI Agent.
aiMiddleClickLocate and middle-click an element with a Midscene UI Agent.
aiNumberRun aiNumber with a Midscene UI Agent and store its value.
aiPinchPerform a pinch-in or pinch-out gesture with a Midscene UI Agent.
aiQueryExtract structured data from the current interface and store the result.
aiRightClickLocate and right-click an element with a Midscene UI Agent.
aiScrollScroll the page or a located region with a Midscene UI Agent.
aiStringRun aiString with a Midscene UI Agent and store its value.
aiTapLocate and tap an element with a Midscene UI Agent.
aiWaitForWait until a natural-language condition is satisfied.
backTrigger the Android system back operation.
homeTrigger the Android system home operation.
javascriptEvaluate JavaScript in the current interface and store the result.
launchLaunch an application through the current Android Agent.
recentAppsTrigger the Android system recent apps operation.
recordToReportAdd text or screenshots to the current Midscene report.
runAdbShellExecute a shell command through the current Android Agent. Pass only the shell command, without the adb shell prefix.
runGherkinScenarioExecute a Gherkin scenario with the current Midscene UI Agent.
setAIContextSet or remove Agent-level AI guidance for subsequent calls on the same Agent.
sleepWait for a fixed number of milliseconds, recording standard UI snapshots and honoring cancellation.
terminateTerminate an application through the current Android Agent.
waitWait for a fixed duration while honoring cancellation.

Where to use these Nodes ​

Use these Nodes in Workflow Documents (.yaml or .yml files) selected by an Execution Project. Case file patterns and the config file path below are relative to this spec file. Case file patterns use glob syntax. A custom --config path does not change where case files are selected.

Projects created by midscene-test create select cases/**/*.{yaml,yml} by default, so you can write test cases in cases/example.yaml or subdirectories of cases/. If an Execution Project has no files configuration, Midscene Test searches **/*.{yaml,yml} recursively instead. Check projects[].files in your configuration before choosing a file location.

Config file: midscene.config.ts

Case files: cases/android/**/*.{yaml,yml} (Execution Project: android)

Files matching files.exclude are not selected. Midscene Test always ignores .git/, .midscene/, midscene_run/, and node_modules/ directories, including nested ones.

Call a Node in cases[].steps, or in the Workflow Document lifecycle steps beforeAll, beforeEach, afterEach, and afterAll. Root Nodes are shared defaults; projects[].nodes adds local Nodes and overrides same-named root Nodes only within that Execution Project. Each Execution Project supplies its own runtime environment.

Workflow Step Contract ​

Each step uses a node name as its key. The $ object contains engine metadata and is not part of the node input.

yaml
cases:
  - name: Example case
    steps:
      - node.name:
          prompt: Describe the task.
          $:
            timeout: 30000
            continue-on-error: false

A Node may map a string step value to one declared input field. Each Node section states whether it supports this shorthand and names the target field.

Each Node's returned data is saved on that Step's result. Results are not named or automatically passed to later Steps. A failed Case does not stop later Cases by default; test.bail controls early stopping across the run.

Node Details ​

aiAct ​

Perform a natural-language task with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "anyOf": [
            {
              "const": "unset"
            },
            {
              "type": "boolean"
            }
          ]
        },
        "effort": {
          "enum": [
            "fast",
            "balance",
            "deepThink"
          ]
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "fileChooserAllowedDir": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiAssert ​

Assert a natural-language condition with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "message": {
      "type": "string"
    },
    "options": {
      "additionalProperties": false,
      "properties": {
        "context": {
          "type": "string"
        },
        "domIncluded": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "const": "visible-only"
            }
          ]
        },
        "keepRawResponse": {
          "type": "boolean"
        },
        "screenshotIncluded": {
          "type": "boolean"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

action ​

Call a platform or custom action. Its ActionSpace schema validates params when the action executes.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "name": {
      "format": "regex",
      "pattern": "\\S",
      "type": "string"
    },
    "params": {}
  },
  "required": [
    "name"
  ],
  "type": "object"
}

aiAsk ​

Run aiAsk with a Midscene UI Agent and store its value.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "context": {
          "type": "string"
        },
        "domIncluded": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "const": "visible-only"
            }
          ]
        },
        "screenshotIncluded": {
          "type": "boolean"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiBoolean ​

Run aiBoolean with a Midscene UI Agent and store its value.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "context": {
          "type": "string"
        },
        "domIncluded": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "const": "visible-only"
            }
          ]
        },
        "screenshotIncluded": {
          "type": "boolean"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiClearInput ​

Locate an input element and clear its value with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiDoubleClick ​

Locate and double-click an element with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiDragAndDrop ​

Locate source and destination elements, then drag the source to the destination.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "from": {
      "$ref": "#/$defs/__schema0"
    },
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "to": {
      "$ref": "#/$defs/__schema0"
    }
  },
  "required": [
    "from",
    "to"
  ],
  "type": "object"
}

aiHover ​

Locate and hover over an element with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiInput ​

Locate an input element and enter a value with a Midscene UI Agent.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "autoDismissKeyboard": {
          "type": "boolean"
        },
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "inputStrategy": {
          "enum": [
            "legacy",
            "sequential",
            "bulk"
          ]
        },
        "keyboardTypeDelay": {
          "minimum": 0,
          "type": "number"
        },
        "mode": {
          "enum": [
            "replace",
            "clear",
            "typeOnly",
            "append"
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    },
    "value": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    }
  },
  "required": [
    "prompt",
    "value"
  ],
  "type": "object"
}

aiKeyboardPress ​

Press a key or key combination, optionally targeting a located element.

String shorthand: Maps to { keyName: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "keyName": {
      "format": "regex",
      "pattern": "\\S",
      "type": "string"
    },
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "keyName"
  ],
  "type": "object"
}

aiLocate ​

Locate an element from a natural-language description and store the result.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiLongPress ​

Locate and long-press an element with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "duration": {
          "minimum": 0,
          "type": "number"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiMiddleClick ​

Locate and middle-click an element with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiNumber ​

Run aiNumber with a Midscene UI Agent and store its value.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "context": {
          "type": "string"
        },
        "domIncluded": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "const": "visible-only"
            }
          ]
        },
        "screenshotIncluded": {
          "type": "boolean"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiPinch ​

Perform a pinch-in or pinch-out gesture with a Midscene UI Agent.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "direction": {
      "enum": [
        "in",
        "out"
      ]
    },
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "distance": {
          "type": "number"
        },
        "duration": {
          "minimum": 0,
          "type": "number"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "direction"
  ],
  "type": "object"
}

aiQuery ​

Extract structured data from the current interface and store the result.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "context": {
          "type": "string"
        },
        "domIncluded": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "const": "visible-only"
            }
          ]
        },
        "screenshotIncluded": {
          "type": "boolean"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": {
            "type": "string"
          },
          "propertyNames": {
            "type": "string"
          },
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiRightClick ​

Locate and right-click an element with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiScroll ​

Scroll the page or a located region with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "direction": {
          "enum": [
            "down",
            "up",
            "right",
            "left"
          ]
        },
        "distance": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "scrollType": {
          "enum": [
            "singleAction",
            "scrollToBottom",
            "scrollToTop",
            "scrollToRight",
            "scrollToLeft",
            "once",
            "untilBottom",
            "untilTop",
            "untilRight",
            "untilLeft"
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [],
  "type": "object"
}

aiString ​

Run aiString with a Midscene UI Agent and store its value.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "context": {
          "type": "string"
        },
        "domIncluded": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "const": "visible-only"
            }
          ]
        },
        "screenshotIncluded": {
          "type": "boolean"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiTap ​

Locate and tap an element with a Midscene UI Agent.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "type": "boolean"
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "xpath": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

aiWaitFor ​

Wait until a natural-language condition is satisfied.

String shorthand: Maps to { prompt: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "checkIntervalMs": {
          "exclusiveMinimum": 0,
          "type": "number"
        },
        "context": {
          "type": "string"
        },
        "domIncluded": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "const": "visible-only"
            }
          ]
        },
        "screenshotIncluded": {
          "type": "boolean"
        },
        "timeoutMs": {
          "exclusiveMinimum": 0,
          "type": "number"
        }
      },
      "required": [],
      "type": "object"
    },
    "prompt": {
      "anyOf": [
        {
          "format": "regex",
          "pattern": "\\S",
          "type": "string"
        },
        {
          "additionalProperties": false,
          "properties": {
            "convertHttpImage2Base64": {
              "type": "boolean"
            },
            "images": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  },
                  "url": {
                    "format": "regex",
                    "pattern": "\\S",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            "prompt": {
              "format": "regex",
              "pattern": "\\S",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      ]
    }
  },
  "required": [
    "prompt"
  ],
  "type": "object"
}

back ​

Trigger the Android system back operation.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {},
  "required": [],
  "type": "object"
}

home ​

Trigger the Android system home operation.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {},
  "required": [],
  "type": "object"
}

javascript ​

Evaluate JavaScript in the current interface and store the result.

String shorthand: Maps to { script: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "script": {
      "format": "regex",
      "pattern": "\\S",
      "type": "string"
    }
  },
  "required": [
    "script"
  ],
  "type": "object"
}

launch ​

Launch an application through the current Android Agent.

String shorthand: Maps to { uri: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "uri": {
      "format": "regex",
      "pattern": "\\S",
      "type": "string"
    }
  },
  "required": [
    "uri"
  ],
  "type": "object"
}

recentApps ​

Trigger the Android system recent apps operation.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {},
  "required": [],
  "type": "object"
}

recordToReport ​

Add text or screenshots to the current Midscene report.

String shorthand: Maps to { title: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "content": {
          "type": "string"
        },
        "screenshotBase64": {
          "type": "string"
        },
        "screenshots": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "base64": {
                "minLength": 1,
                "type": "string"
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "base64"
            ],
            "type": "object"
          },
          "minItems": 1,
          "type": "array"
        }
      },
      "required": [],
      "type": "object"
    },
    "title": {
      "type": "string"
    }
  },
  "required": [],
  "type": "object"
}

runAdbShell ​

Title: Run an ADB shell command

Execute a shell command through the current Android Agent. Pass only the shell command, without the adb shell prefix.

String shorthand: Maps to { command: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "command": {
      "format": "regex",
      "pattern": "\\S",
      "type": "string"
    },
    "options": {
      "additionalProperties": false,
      "properties": {
        "timeout": {
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991,
          "type": "integer"
        }
      },
      "required": [],
      "type": "object"
    }
  },
  "required": [
    "command"
  ],
  "type": "object"
}

runGherkinScenario ​

Execute a Gherkin scenario with the current Midscene UI Agent.

String shorthand: Maps to { scenario: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "options": {
      "additionalProperties": false,
      "properties": {
        "cacheable": {
          "type": "boolean"
        },
        "context": {
          "type": "string"
        },
        "deepLocate": {
          "type": "boolean"
        },
        "deepThink": {
          "anyOf": [
            {
              "const": "unset"
            },
            {
              "type": "boolean"
            }
          ]
        },
        "effort": {
          "enum": [
            "fast",
            "balance",
            "deepThink"
          ]
        },
        "fileChooserAccept": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          ]
        },
        "fileChooserAllowedDir": {
          "type": "string"
        }
      },
      "required": [],
      "type": "object"
    },
    "scenario": {
      "format": "regex",
      "pattern": "\\S",
      "type": "string"
    }
  },
  "required": [
    "scenario"
  ],
  "type": "object"
}

setAIContext ​

Set or remove Agent-level AI guidance for subsequent calls on the same Agent.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "target": {
      "enum": [
        "default",
        "aiAct",
        "aiTap",
        "aiRightClick",
        "aiMiddleClick",
        "aiDoubleClick",
        "aiHover",
        "aiInput",
        "aiKeyboardPress",
        "aiScroll",
        "aiPinch",
        "aiLongPress",
        "aiClearInput",
        "aiLocate",
        "aiQuery",
        "aiBoolean",
        "aiNumber",
        "aiString",
        "aiAsk",
        "aiAssert",
        "aiWaitFor"
      ]
    }
  },
  "required": [
    "target"
  ],
  "type": "object"
}

sleep ​

Wait for a fixed number of milliseconds, recording standard UI snapshots and honoring cancellation.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "ms": {
      "exclusiveMinimum": 0,
      "type": "number"
    }
  },
  "required": [
    "ms"
  ],
  "type": "object"
}

terminate ​

Terminate an application through the current Android Agent.

String shorthand: Maps to { uri: value }.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "uri": {
      "format": "regex",
      "pattern": "\\S",
      "type": "string"
    }
  },
  "required": [
    "uri"
  ],
  "type": "object"
}

wait ​

Wait for a fixed duration while honoring cancellation.

String shorthand: Not supported by this Node.

Input Schema ​

json
{
  "$schema": "https://json-schema.org/draft-2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "duration": {
      "exclusiveMinimum": 0,
      "type": "number"
    },
    "unit": {
      "default": "ms",
      "enum": [
        "ms",
        "s",
        "min"
      ]
    }
  },
  "required": [
    "duration"
  ],
  "type": "object"
}

内部文档,仅供测试团队使用