From 41f1f9550964563df64e6535b0c2752c944c0c46 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Mon, 18 Sep 2023 14:02:15 +0200 Subject: [PATCH] PW: replace deprecated type() with pressSequentially() for OTPs --- epic-games.js | 4 ++-- gog.js | 2 +- prime-gaming.js | 2 +- unrealengine.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/epic-games.js b/epic-games.js index 976ce07d..16984a39 100644 --- a/epic-games.js +++ b/epic-games.js @@ -99,7 +99,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 { @@ -196,7 +196,7 @@ try { console.error(' EG_PARENTALPIN not set. Need to enter Parental Control PIN manually.'); notify('epic-games: EG_PARENTALPIN not set. Need to enter Parental Control PIN manually.'); } - await iframe.locator('input.payment-pin-code__input').first().type(cfg.eg_parentalpin); + await iframe.locator('input.payment-pin-code__input').first().pressSequentially(cfg.eg_parentalpin); await iframe.locator('button:has-text("Continue")').click({ delay: 11 }); }).catch(_ => { }); diff --git a/gog.js b/gog.js index e41eed73..be4514d3 100644 --- a/gog.js +++ b/gog.js @@ -61,7 +61,7 @@ try { console.log('Two-Step Verification - Enter security code'); console.log(await iframe.locator('.form__description').innerText()) const otp = await prompt({type: 'text', message: 'Enter two-factor sign in code', validate: n => n.toString().length == 4 || 'The code must be 4 digits!'}); // can't use type: 'number' since it strips away leading zeros and codes sometimes have them - await iframe.locator('#second_step_authentication_token_letter_1').type(otp.toString(), {delay: 10}); + await iframe.locator('#second_step_authentication_token_letter_1').pressSequentially(otp.toString(), {delay: 10}); await iframe.locator('#second_step_authentication_send').click(); await page.waitForTimeout(1000); // TODO still needed with wait for username below? }).catch(_ => { }); diff --git a/prime-gaming.js b/prime-gaming.js index 38167779..8fcfa2b9 100644 --- a/prime-gaming.js +++ b/prime-gaming.js @@ -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 { diff --git a/unrealengine.js b/unrealengine.js index 55d4e58e..f7ee6fae 100644 --- a/unrealengine.js +++ b/unrealengine.js @@ -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 {