.findByPlaceholderText() Suggest edits
Since: 3.0.0Search for an element on the page that have the placeholder attribute with a specified text.
Element can be searched by using another element as the starting point.
By default, provided text is treated as a substring, so for the 'foo' will match 'foobar' also.
If you need an exact comparison, provide the { exact: true } as the second parameter.
Usage
browser.element.findByPlaceholderText(text, [options])
Example
export default {
demoTest(browser: NightwatchAPI): void {
// Search by the substring matching.
const inputs = browser.element.findByPlaceholderText('group of people');
// Search for the exact occurrence.
const images = browser.element.findByPlaceholderText(
'Search here',
{ exact: true }
);
const images = browser.element.findByPlaceholderText(
'Enter the number',
{ exact: true, suppressNotFoundError: true }
);
}
}
Parameters
| Name | Type | description |
|---|---|---|
text |
string | |
optionsOptional |
[object Object] |
Returns
| Type | description |
|---|---|
| ScopedWebElement |