chore: DRY up mouse.click() (#9725)
This commit is contained in:
parent
9910aae2f7
commit
81bf443789
@ -478,18 +478,14 @@ export class Mouse {
|
||||
options: MouseOptions & {delay?: number} = {}
|
||||
): Promise<void> {
|
||||
const {delay = null} = options;
|
||||
await this.move(x, y);
|
||||
await this.down(options);
|
||||
if (delay !== null) {
|
||||
await this.move(x, y);
|
||||
await this.down(options);
|
||||
await new Promise(f => {
|
||||
return setTimeout(f, delay);
|
||||
});
|
||||
await this.up(options);
|
||||
} else {
|
||||
await this.move(x, y);
|
||||
await this.down(options);
|
||||
await this.up(options);
|
||||
}
|
||||
await this.up(options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user