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 <mathias@qiwi.be>
This commit is contained in:
Pierpaolo Tommasi 2021-04-19 08:04:37 +01:00 committed by GitHub
parent c239d9edc7
commit ba7c367de3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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