page_expectElementText
Assert element text against expected value using exact or substring matching. Returns pass status and actual text for efficient debugging.
Instructions
一次性断言元素文本(element.text(),含子节点渲染文本,非 input 的 value)是否匹配预期。mode='equals'(默认,整串精确相等) 或 'includes'(子串包含)。返回 {pass,expected,actual,snapshot:{selector,mode}}——读 pass,失败时看 actual 排查。结果超过 maxBytes(默认 50000B)会截断。⚠️ 与 page_expectVisible/Count 不同:元素不存在时本工具抛错(而非返回 pass:false)。支持 selector[index=N](0 基)。校验 input/textarea 的输入值请改走 element 取 value,不要用本工具。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | equals | |
| expected | Yes | ||
| maxBytes | 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。 |