innerText(selector[, options])
警告
请改用基于 locator 的
locator.innerText([options])。
返回 element.innerText 的值。
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| selector | 字符串 | '' | 用于搜索元素的 selector。如果多个元素满足该 selector,将使用第一个。 |
| options | 对象 | null | |
| options.strict | 布尔值 | false | 当为 true 时,要求 selector 解析为单个元素。如果给定的 selector 解析为多个元素,调用将抛出异常。 |
| options.timeout | 数字 | 30000 | 最大超时时间(毫秒)。传入 0 表示禁用超时。默认值会被 BrowserContext 或 Page 上的 setDefaultTimeout 选项覆盖。 |
返回值
| 类型 | 描述 |
|---|---|
Promise<string> | 一个 Promise,当成功时将返回元素的内部文本(表示元素句柄及其后代的渲染文本内容)。 |


