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);
try { while (true) {
await page.waitForSelector("#labeled-input-password", { timeout: 2500 }); try {
await page.waitForSelector("button.btn.btn-orange"); await page.waitForSelector("#labeled-input-password", { timeout: 2500 });
await page.type("#labeled-input-password", config.password); await page.waitForSelector("button.btn.btn-orange");
await page.click("button.btn.btn-orange"); await page.type("#labeled-input-password", config.password);
log("Successfully logged in"); await page.click("button.btn.btn-orange");
} catch (err) { log("Successfully logged in");
log("Fail: Manual authorization code required by Newegg. This should only happen once."); break;
success = false; } catch (err) {
try {
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();
} }
} }