mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(Page.type): Add assertion to page.type() (#1301)
This patch starts throwing a nice error when `page.type` is called with non-existent selector.
This commit is contained in:
parent
2f7c77875e
commit
cc5e8a9bd4
@ -795,6 +795,7 @@ class Page extends EventEmitter {
|
||||
*/
|
||||
async type(selector, text, options) {
|
||||
const handle = await this.$(selector);
|
||||
console.assert(handle, 'No node found for selector: ' + selector);
|
||||
await handle.type(text, options);
|
||||
await handle.dispose();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user