page_waitElement
Poll until a specified element appears on the page, confirming its existence after async rendering or SSE. Use before reading element content.
Instructions
轮询等待选择器对应的元素出现(最长 timeout 毫秒,每 retryInterval 毫秒重试一次)。何时用:元素来自 setData 后异步渲染 / SSE 流式 / navigateTo 未稳定——先 wait 到再用 page_getElement 取内容(本工具只确认出现,返回 {selector,index?,found:true,waitTime},不返回元素摘要)。元素若必然已存在则直接用 page_getElement(一次性、不存在即抛错)。等任意非元素条件(page.data 字段变化 / SSE done / aiStatus='completed')用 mp_pollUntil(通用 predicate 轮询)。支持 selector[index=N](0 基)。timeout 默认 5000ms,SSE/异步场景建议调大到 10000+;retryInterval 默认 200ms。超时抛错并带具体排查建议(模板插值 class / shadow 不穿透 / 连接级故障 / timeout 太短)。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timeout | No | ||
| selector | Yes | ||
| connection | No | 可选连接覆盖(不传则用默认会话)。可用字段:mode(launch|connect)、cliPath、projectPath、wsEndpoint、timeout、port(【自动化端口】→ cli auto --auto-port,默认 9420;不是 IDE HTTP 服务端口,别把 IDE 服务端口传进来)、account、ticket、trustProject、args、cwd、autoClose、autoLaunch、launchTimeout、connectTimeout。 | |
| retryInterval | No |