mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
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> {
|
): Promise<void> {
|
||||||
const { delay = null } = options;
|
const { delay = null } = options;
|
||||||
if (delay !== null) {
|
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 new Promise((f) => setTimeout(f, delay));
|
||||||
await this.up(options);
|
await this.up(options);
|
||||||
} else {
|
} else {
|
||||||
await Promise.all([
|
await this.move(x, y);
|
||||||
this.move(x, y),
|
await this.down(options);
|
||||||
this.down(options),
|
await this.up(options);
|
||||||
this.up(options),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user