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:
parent
c239d9edc7
commit
ba7c367de3
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user