PW: replace deprecated type() with pressSequentially() for OTPs

This commit is contained in:
Ralf Vogler 2023-09-18 14:02:15 +02:00
parent 840d35c2d2
commit 41f1f95509
4 changed files with 5 additions and 5 deletions

View file

@ -68,7 +68,7 @@ try {
console.log('Two-Step Verification - enter the One Time Password (OTP), e.g. generated by your Authenticator App');
await page.check('[name=rememberDevice]');
const otp = cfg.pg_otpkey && authenticator.generate(cfg.pg_otpkey) || await prompt({type: 'text', message: 'Enter two-factor sign in code', validate: n => n.toString().length == 6 || 'The code must be 6 digits!'}); // can't use type: 'number' since it strips away leading zeros and codes sometimes have them
await page.type('input[name=otpCode]', otp.toString());
await page.locator('input[name=otpCode]').pressSequentially(otp.toString());
await page.click('input[type="submit"]');
}).catch(_ => { });
} else {