.findAllByText() 建议编辑
自: 3.0.0搜索页面上包含指定文本的元素。
可以使用另一个元素作为起点来搜索元素。
默认情况下,提供的文本被视为子字符串,因此 'foo' 也会匹配 'foobar'。
如果需要精确比较,请将 { exact: true } 作为第二个参数提供。
用法
browser.element.findAllByText(text, [options])
示例
export default {
demoTest(browser: NightwatchAPI): void {
// Search by the substring matching.
const inputs = browser.element.findAllByText('group of people');
// Search for the exact occurrence.
const images = browser.element.findAllByText(
'The nostalgic office',
{ exact: true }
);
}
}
参数
| 名称 | 类型 | 描述 |
|---|---|---|
text |
string | |
options可选 |
[object Object] |
返回
| 类型 | 描述 |
|---|---|
| Array.<ScopeWebElement> |