From 9923e56b3ed05cde014c0047a4f65fef7749ebb0 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Thu, 30 Jan 2020 23:43:34 -0800 Subject: [PATCH] fix(filechooser): quick fix for the headful file chooser (#5369) Fixes #5363 --- lib/Page.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Page.js b/lib/Page.js index 3fa522c6c4ee5..317b9fca996e3 100644 --- a/lib/Page.js +++ b/lib/Page.js @@ -135,7 +135,6 @@ class Page extends EventEmitter { this._client.send('Target.setAutoAttach', {autoAttach: true, waitForDebuggerOnStart: false, flatten: true}), this._client.send('Performance.enable', {}), this._client.send('Log.enable', {}), - this._client.send('Page.setInterceptFileChooserDialog', {enabled: true}), ]); } @@ -160,6 +159,9 @@ class Page extends EventEmitter { * @return !Promise} */ async waitForFileChooser(options = {}) { + if (!this._fileChooserInterceptors.size) + await this._client.send('Page.setInterceptFileChooserDialog', {enabled: true}); + const { timeout = this._timeoutSettings.timeout(), } = options;