PW: replace deprecated type() with pressSequentially() for OTPs
This commit is contained in:
parent
840d35c2d2
commit
41f1f95509
4 changed files with 5 additions and 5 deletions
|
|
@ -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 ...');
|
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?)
|
// 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
|
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"]');
|
await page.click('button[type="submit"]');
|
||||||
}).catch(_ => { });
|
}).catch(_ => { });
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -196,7 +196,7 @@ try {
|
||||||
console.error(' EG_PARENTALPIN not set. Need to enter Parental Control PIN manually.');
|
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.');
|
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 });
|
await iframe.locator('button:has-text("Continue")').click({ delay: 11 });
|
||||||
}).catch(_ => { });
|
}).catch(_ => { });
|
||||||
|
|
||||||
|
|
|
||||||
2
gog.js
2
gog.js
|
|
@ -61,7 +61,7 @@ try {
|
||||||
console.log('Two-Step Verification - Enter security code');
|
console.log('Two-Step Verification - Enter security code');
|
||||||
console.log(await iframe.locator('.form__description').innerText())
|
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
|
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 iframe.locator('#second_step_authentication_send').click();
|
||||||
await page.waitForTimeout(1000); // TODO still needed with wait for username below?
|
await page.waitForTimeout(1000); // TODO still needed with wait for username below?
|
||||||
}).catch(_ => { });
|
}).catch(_ => { });
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ try {
|
||||||
console.log('Two-Step Verification - enter the One Time Password (OTP), e.g. generated by your Authenticator App');
|
console.log('Two-Step Verification - enter the One Time Password (OTP), e.g. generated by your Authenticator App');
|
||||||
await page.check('[name=rememberDevice]');
|
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
|
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"]');
|
await page.click('input[type="submit"]');
|
||||||
}).catch(_ => { });
|
}).catch(_ => { });
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -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 ...');
|
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?)
|
// 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
|
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"]');
|
await page.click('button[type="submit"]');
|
||||||
}).catch(_ => { });
|
}).catch(_ => { });
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue