From b8b22fe869a9b385add136694e35e340048da95b Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 5 Jan 2021 00:33:45 -0500 Subject: [PATCH] Increase the timeouts for controls appearing, and decrease the time between checking the active time to every 30 seconds --- newegg-purchaser.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/newegg-purchaser.js b/newegg-purchaser.js index f495756..ed219e9 100755 --- a/newegg-purchaser.js +++ b/newegg-purchaser.js @@ -58,14 +58,14 @@ async function run() { if (page.url().includes("signin")) { try { - await page.waitForSelector("button.btn.btn-orange", { timeout: 2500 }); + await page.waitForSelector("button.btn.btn-orange", { timeout: 5000 }); await page.type("#labeled-input-signEmail", config.username); await page.click("button.btn.btn-orange"); await page.waitForTimeout(1500); while (true) { try { - await page.waitForSelector("#labeled-input-password", { timeout: 2500 }); + await page.waitForSelector("#labeled-input-password", { timeout: 5000 }); await page.waitForSelector("button.btn.btn-orange"); await page.type("#labeled-input-password", config.password); await page.click("button.btn.btn-orange"); @@ -73,7 +73,7 @@ async function run() { break; } catch (err) { try { - await page.waitForSelector(".nav-complex-inner .fa-caret-down", { timeout: 2500 }); + await page.waitForSelector(".nav-complex-inner .fa-caret-down", { timeout: 5000 }); log("Successfully logged in"); break; } catch (err) { @@ -133,7 +133,7 @@ async function run() { } } else { log(`${date.getHours()}:${date.getMinutes()} is outside the active time period between ${config.start_time} and ${config.end_time}`); - await page.waitForTimeout(60000); + await page.waitForTimeout(30000); } } } @@ -161,7 +161,7 @@ async function run() { if (await clickButtonWithText(page, "Continue to payment")) { log("Continuing to payment..."); - await page.waitForSelector("[placeholder=\"CVV2\"]", { timeout: 2500 }); + await page.waitForSelector("[placeholder=\"CVV2\"]", { timeout: 5000 }); await page.waitForTimeout(1000); log("Filling out the cv2..."); await page.type("[placeholder=\"CVV2\"]", config.cv2);