eg: don't exit on login error since it may be 'Incorrect response' for captcha

https://github.com/vogler/free-games-claimer/issues/183#issuecomment-2195691372
This commit is contained in:
Ralf Vogler 2024-06-27 23:32:15 +02:00
parent aee72327ea
commit 17f1ee41c9

View file

@ -103,7 +103,7 @@ try {
await notify('epic-games: got captcha during login. Please check.'); await notify('epic-games: got captcha during login. Please check.');
}).catch(_ => { }); }).catch(_ => { });
page.waitForSelector('p:has-text("Incorrect response.")').then(async () => { page.waitForSelector('p:has-text("Incorrect response.")').then(async () => {
console.error('Incorrect repsonse for captcha!'); console.error('Incorrect response for captcha!');
}).catch(_ => { }); }).catch(_ => { });
await page.fill('#email', email); await page.fill('#email', email);
// await page.click('button[type="submit"]'); login was split in two steps for some time, now email and password are on the same form again // await page.click('button[type="submit"]'); login was split in two steps for some time, now email and password are on the same form again
@ -116,8 +116,7 @@ try {
const error = page.locator('#form-error-message'); const error = page.locator('#form-error-message');
error.waitFor().then(async () => { error.waitFor().then(async () => {
console.error('Login error:', await error.innerText()); console.error('Login error:', await error.innerText());
await context.close(); // finishes potential recording console.log('Please login in the browser!');
process.exit(1);
}).catch(_ => { }); }).catch(_ => { });
// handle MFA, but don't await it // handle MFA, but don't await it
page.waitForURL('**/id/login/mfa**').then(async () => { page.waitForURL('**/id/login/mfa**').then(async () => {