.findByText() 編集を提案
Since: 3.0.0指定されたテキストを含むページ上の要素を検索します。
要素は、別の要素を開始点として使用して検索できます。
デフォルトでは、指定されたテキストは部分文字列として扱われるため、'foo'
は'foobar'
にも一致します。
正確な比較が必要な場合は、2番目のパラメーターとして{ exact: true }
を指定します。
使用方法
browser.element.findByText(text, [options])
例
export default {
demoTest(browser: NightwatchAPI): void {
// Search by the substring matching.
const inputs = browser.element.findByText('group of people');
// Search for the exact occurrence.
const images = browser.element.findByText(
'The nostalgic office',
{ exact: true }
);
}
}
パラメーター
名前 | 型 | 説明 |
---|---|---|
text |
string | |
options オプション |
[object Object] |
戻り値
型 | 説明 |
---|---|
ScopedWebElement |