Skip to content

Commit

Permalink
fix(page): fix mouse.click method (#7097)
Browse files Browse the repository at this point in the history
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 <mathias@qiwi.be>
  • Loading branch information
ptommasi and mathiasbynens committed Apr 19, 2021
1 parent c239d9e commit ba7c367
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/common/Input.ts
Expand Up @@ -409,15 +409,14 @@ export class Mouse {
): Promise<void> {
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);
}
}

Expand Down

0 comments on commit ba7c367

Please sign in to comment.