跳到正文
所有工具

web_wait_for

网页自动化 · macOS · Windows

效果: 写入. 状态: 受限可用.

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

macOS

用途

等待(轮询,而非固定睡眠)直到某个元素出现在页面上,或超时。适用于加载后才进行水合的 SPA 页面。优先使用 `selector`(CSS 选择器,例如 "input[name=password]")。`condition` 也接受 "document.querySelector('...')" 的形式;任何其他 JavaScript 条件都会在页面上运行任意代码(与 web_eval 的能力相同):它需要 confirm=true,不传时只会得到不运行任何内容的预览。当 LMCP 处于只读模式时禁用。返回 met:true/false。

必填输入

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

权限与确认

架构声明了明确的确认参数。请检查预览,并按此平台的契约授权实际操作。

英文规范技术架构 — macOS
{
  "properties": {
    "condition": {
      "description": "Alternative to selector: \"document.querySelector('...')\" is accepted as-is; any other JS expression runs arbitrary code on the page (same power as web_eval).",
      "type": "string"
    },
    "confirm": {
      "description": "Must be true to run a `condition` that is arbitrary JavaScript. Without it, returns a preview and runs nothing. Not needed for `selector` or the document.querySelector('...') form.",
      "type": "boolean"
    },
    "selector": {
      "description": "CSS selector to wait for (preferred; treated as data, never executed). e.g. .feed",
      "type": "string"
    },
    "session": {
      "description": "Session name (default 'default').",
      "type": "string"
    },
    "timeout_seconds": {
      "description": "Max seconds to wait (default 15).",
      "type": "integer"
    }
  },
  "required": [],
  "type": "object"
}

文档示例

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

{
  "confirm": false,
  "selector": "h1",
  "session": "demo-browser"
}

Windows

用途

等待(轮询,而非固定睡眠)直到某个元素出现(或页面条件成立),或超时。优先使用 `selector` 参数:作为数据等待的 CSS 选择器(例如 selector "input[name=password]")。为了兼容,`condition` 也接受文档所述的 "document.querySelector('SEL')" 形式,或任何其他要在页面上求值的 JavaScript,这需要 confirm=true(不传时只会得到预览,不运行任何内容)。返回 met:true/false。

必填输入

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

权限与确认

架构声明了明确的确认参数。请检查预览,并按此平台的契约授权实际操作。

英文规范技术架构 — Windows
{
  "properties": {
    "condition": {
      "description": "Alternative to selector: \"document.querySelector('SEL')\" (compat), or any other JavaScript.",
      "type": "string"
    },
    "confirm": {
      "description": "Must be true to run a `condition` that is arbitrary JavaScript. Without it, returns a preview and runs nothing. Not needed for `selector` or the document.querySelector('SEL') form.",
      "type": "boolean"
    },
    "selector": {
      "description": "CSS selector to wait for (preferred; treated as data, never executed). e.g. .feed, input[name=password]",
      "type": "string"
    },
    "session": {
      "description": "Session name (default 'default').",
      "type": "string"
    },
    "timeout_seconds": {
      "description": "Max seconds to wait (default 15).",
      "type": "integer"
    }
  },
  "required": [],
  "type": "object"
}

文档示例

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

{
  "confirm": false,
  "selector": "h1",
  "session": "demo-browser"
}