page_expectVisible
Verify that a CSS selector can locate elements in the page, returning pass/fail based on existence or index range, without checking visual visibility.
Instructions
一次性断言选择器能否在页面定位到元素(基于 page.$$ 命中数 > 0,或带 [index=N] 时该索引在范围内)。⚠️ 只判「存在/可定位」,不检查视觉可见性(不看 display/opacity/视口)。不轮询、不抛错——结果在返回的 {pass,expected:true,actual,snapshot:{selector,count,index}} 的 pass 里。⚠️ page.$$ 默认不穿透自定义组件(是否穿透取决于组件 styleIsolation/addGlobalClass,可用 page_getElements 看实际命中数判断),组件内部元素会误判 pass:false,此类用 element_getInnerElements 校验。支持 selector[index=N](0 基)。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| 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。 |