From cc5e8a9bd4dea41188b6c5d1e193fa52006e69db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sk=C3=B6ld?= Date: Tue, 7 Nov 2017 12:07:51 +0100 Subject: [PATCH] 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. --- lib/Page.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Page.js b/lib/Page.js index 00120139d28..977885f9cf0 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -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(); }