From 5e2aaca280c31b1bf27483d462e8b3cdb73b1e61 Mon Sep 17 00:00:00 2001 From: Casey Timm Date: Wed, 23 Jul 2025 21:11:34 -0400 Subject: [PATCH] some fixes --- src/lib/united.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/united.js b/src/lib/united.js index c10f140..5171e6d 100644 --- a/src/lib/united.js +++ b/src/lib/united.js @@ -32,8 +32,8 @@ export async function pullData(amount = 100) { needCode = false; state.push('Starting Browser'); const browser = await puppeteer.launch({ - args: ['--no-sandbox'] - //headless: false + args: ['--no-sandbox'], + headless: true //defaultViewport: null, //args: ['--disable-blink-features=PrettyPrintJSONDocument'] }); @@ -98,10 +98,14 @@ export async function pullData(amount = 100) { if (url.includes('mfa/targets')) { state.push('MFA required, selecting SMS option'); console.log('MFA required, please complete the authentication process.'); + await new Promise((resolve) => setTimeout(resolve, Math.random() * 5000)); + await page.locator('aria/SMS: (XXX) XXX-4029').click(); await page.waitForNavigation(); //need to do some stuff ehre - await page.keyboard.press('Tab'); + await new Promise((resolve) => setTimeout(resolve, Math.random() * 5000)); + + //await page.keyboard.press('Tab'); state.push('Waiting for code input'); needCode = true; for (let i = 0; i < 5 * 60; i++) { @@ -115,7 +119,8 @@ export async function pullData(amount = 100) { } state.push(`Got code: ${code}`); - await page.keyboard.type(code); + await page.locator('>>> [placeholder="Secure Access Code"]').fill(code); + //await page.keyboard.type(code); code = null; needCode = false; await page.keyboard.press('Enter'); @@ -137,6 +142,8 @@ export async function pullData(amount = 100) { }); } + //await new Promise((resolve) => setTimeout(resolve, 60000)); + state.push('Fetching q2token'); const q2token = (await browser.cookies()).find((cookie) => cookie.name === 'q2token')?.value;