搜尋頁面上具有指定文字的 placeholder 屬性的元素。
可以使用另一個元素作為起點來搜尋元素。
預設情況下,提供的文字會被視為子字串,因此 'foo' 也會比對到 'foobar'
如果您需要精確比對,請提供 { exact: true } 作為第二個參數。

用法

                    browser.element.findAllByPlaceholderText(text, [options])
                

範例

export default {
  demoTest(browser: NightwatchAPI): void {
    // Search by the substring matching.
    const inputs = browser.element.findAllByPlaceholderText('group of people');

    // Search for the exact occurrence.
    const images = browser.element.findAllByPlaceholderText(
      'Search here',
      { exact: true }
    );

    const images = browser.element.findAllByPlaceholderText(
      'Enter the number',
      { exact: true, suppressNotFoundError: true }
    );
  }
}

參數

名稱 類型 描述
text 字串
options
可選
[object Object]

傳回

類型 描述
Array.<ScopeWebElement>