From ba7c367de33ace7753fd9d8b8cc894b2c14ab6c2 Mon Sep 17 00:00:00 2001 From: Pierpaolo Tommasi <12100986+ptommasi@users.noreply.github.com> Date: Mon, 19 Apr 2021 08:04:37 +0100 Subject: [PATCH] fix(page): fix mouse.click method (#7097) The `Page#click` method relies on `Mouse#click` for execution. `Mouse#click` triggers the `move`, `down`, and `up` methods in parallel waiting for all of them to finish, when they should be called sequentially instead. Issue: #6462, #3347 Co-authored-by: Mathias Bynens --- src/common/Input.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/common/Input.ts b/src/common/Input.ts index 31237062..c568856a 100644 --- a/src/common/Input.ts +++ b/src/common/Input.ts @@ -409,15 +409,14 @@ export class Mouse { ): Promise { const { delay = null } = options; if (delay !== null) { - await Promise.all([this.move(x, y), this.down(options)]); + await this.move(x, y); + await this.down(options); await new Promise((f) => setTimeout(f, delay)); await this.up(options); } else { - await Promise.all([ - this.move(x, y), - this.down(options), - this.up(options), - ]); + await this.move(x, y); + await this.down(options); + await this.up(options); } }