所有工具

ui_wait_for_element

屏幕、窗口与界面 · macOS · Windows

效果: 读取. 状态: 受限可用.

“受限可用”表示工具可能取决于版本、平台、权限、账户或配置,并不表示它在所有安装中都已启用。

macOS

用途

确定性同步:替代所有 sleep。轮询元素,直到它达到 state(present|enabled|focused|absent)或超时。超时是明确错误,绝不会伪装为成功。返回 {satisfied, waited_ms, element_ref?, bounds?, enabled_unknown?}。除非应用发布 AXEnabled=false,否则 state:'enabled' 会被视为满足;如果应用完全不发布 AXEnabled,结果会带有 enabled_unknown:true。此时等待不会阻塞,但实际上没有验证启用状态。

必填输入

此平台的架构未声明必填输入,但仍可能存在可选选择器或运行时要求。

权限与确认

架构未声明明确的确认参数。这并不代表可以未经许可操作;请检查效果并取得授权。

英文规范技术架构macOS
{
  "properties": {
    "app_bundle_id": {
      "type": "string"
    },
    "label": {
      "type": "string"
    },
    "match": {
      "enum": [
        "exact",
        "contains"
      ],
      "type": "string"
    },
    "poll_ms": {
      "description": "Default 150.",
      "type": "integer"
    },
    "role": {
      "type": "string"
    },
    "state": {
      "description": "Default present.",
      "enum": [
        "present",
        "enabled",
        "focused",
        "absent"
      ],
      "type": "string"
    },
    "timeout_ms": {
      "description": "Default 5000.",
      "type": "integer"
    },
    "window_id": {
      "type": "string"
    }
  },
  "required": [],
  "type": "object"
}

文档示例

ui_wait_for_element 的文档示例。请勿执行此示例。所示参数属于虚构数据集;在实际调用前,请解析真实标识符并获得授权。

{
  "label": "Save"
}

Windows

用途

确定性同步:替代所有 sleep。轮询元素,直到它达到 state(present|enabled|focused|absent)或超时。超时是明确错误,绝不会伪装为成功。返回 {satisfied, waited_ms, element_ref?, bounds?}。

必填输入

此平台的架构未声明必填输入,但仍可能存在可选选择器或运行时要求。

权限与确认

架构未声明明确的确认参数。这并不代表可以未经许可操作;请检查效果并取得授权。

英文规范技术架构Windows
{
  "properties": {
    "app": {
      "type": "string"
    },
    "label": {
      "type": "string"
    },
    "match": {
      "enum": [
        "exact",
        "contains"
      ],
      "type": "string"
    },
    "poll_ms": {
      "description": "Default 150.",
      "type": "integer"
    },
    "role": {
      "type": "string"
    },
    "state": {
      "description": "Default present.",
      "enum": [
        "present",
        "enabled",
        "focused",
        "absent"
      ],
      "type": "string"
    },
    "timeout_ms": {
      "description": "Default 5000.",
      "type": "integer"
    }
  },
  "required": [],
  "type": "object"
}

文档示例

ui_wait_for_element 的文档示例。请勿执行此示例。所示参数属于虚构数据集;在实际调用前,请解析真实标识符并获得授权。

{
  "label": "Save"
}