Update to allow manually filling out the security code when newegg forces you to use 2fa

This commit is contained in:
Kevin MacMartin 2020-12-31 20:35:51 -05:00
parent a337d0ad01
commit 34f2e4f9ca

View file

@ -44,15 +44,24 @@ async function run() {
await page.click("button.btn.btn-orange"); await page.click("button.btn.btn-orange");
await page.waitForTimeout(1500); await page.waitForTimeout(1500);
while (true) {
try { try {
await page.waitForSelector("#labeled-input-password", { timeout: 2500 }); await page.waitForSelector("#labeled-input-password", { timeout: 2500 });
await page.waitForSelector("button.btn.btn-orange"); await page.waitForSelector("button.btn.btn-orange");
await page.type("#labeled-input-password", config.password); await page.type("#labeled-input-password", config.password);
await page.click("button.btn.btn-orange"); await page.click("button.btn.btn-orange");
log("Successfully logged in"); log("Successfully logged in");
break;
} catch (err) { } catch (err) {
log("Fail: Manual authorization code required by Newegg. This should only happen once."); try {
success = false; await page.waitForSelector(".nav-complex-inner .fa-caret-down", { timeout: 2500 });
log("Successfully logged in");
break;
} catch (err) {
log("Waiting for authorization");
await page.waitForTimeout(5000);
}
}
} }
} catch (err) { } catch (err) {
log("Fail: Login form missing"); log("Fail: Login form missing");
@ -157,7 +166,7 @@ async function run() {
} }
if (!success) { if (!success) {
await browser.close(); // await browser.close();
} }
} }