.findByLabelText() 編集を提案
Since: 3.0.0指定されたテキストに一致するラベルを検索し、そのラベルに関連付けられた要素を見つけます。
要素は、開始点として別の要素を使用して検索できます。
デフォルトでは、指定されたテキストは部分文字列として扱われるため、'foo'
は 'foobar'
にも一致します。
完全一致が必要な場合は、2番目のパラメータとして { exact: true }
を指定してください。
使用方法
browser.element.findByLabelText(text, [options])
例
export default {
demoTest(browser: NightwatchAPI): void {
// Search by the substring matching.
const image = browser.element.findByLabelText('dreamers');
// Search for the exact occurrence.
const image = browser.element.findByLabelText(
'A group of people sitting in front of a computer.',
{ exact: true }
);
}
}
パラメータ
名前 | タイプ | 説明 |
---|---|---|
text |
string | |
options オプション |
[object Object] |
戻り値
タイプ | 説明 |
---|---|
ScopedWebElement |