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

@ -72,7 +72,7 @@ try {
console.log('Enter the security code to continue - This appears to be a new device, browser or location. A security code has been sent to your email address at ...');
// TODO locator for text (email or app?)
const otp = cfg.eg_otpkey && authenticator.generate(cfg.eg_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="code-input-0"]', otp.toString());
await page.locator('input[name="code-input-0"]').pressSequentially(otp.toString());
await page.click('button[type="submit"]');
}).catch(_ => { });
} else {