Increase the timeouts for controls appearing, and decrease the time between checking the active time to every 30 seconds

This commit is contained in:
Kevin MacMartin 2021-01-05 00:33:45 -05:00
parent 080e5a611d
commit b8b22fe869

View file

@ -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);