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:
Robert Sköld 2017-11-07 12:07:51 +01:00 committed by Andrey Lushnikov
parent 2f7c77875e
commit cc5e8a9bd4

View File

@ -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();
}