From bfbba49239de63ac3df5ac628d8f5a62893a9c3f Mon Sep 17 00:00:00 2001 From: adrapier Date: Wed, 1 Jul 2026 08:21:51 +0000 Subject: [PATCH] Update bot.js --- bot.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/bot.js b/bot.js index f686f43..05bdc9e 100644 --- a/bot.js +++ b/bot.js @@ -135,9 +135,28 @@ async function addAccount(browser, account, index, total, config) { await page.getByRole('link', { name: /Antigravity/ }).click(); await page.waitForLoadState('networkidle'); - // Click Add button - await page.getByRole('button', { name: 'add Add', exact: true }).click(); + // Click Add button (icon text may vary depending on UI version) await sleep(1000); + let addClicked = false; + + // Try exact match first + const addExact = page.getByRole('button', { name: 'add Add', exact: true }); + if (await addExact.isVisible({ timeout: 3000 }).catch(() => false)) { + console.log(' [>] Add Connection → "add Add" (exact)'); + await addExact.click(); + addClicked = true; + } + + // Fallback: try other variants + if (!addClicked) { + addClicked = await clickAny(page, [ + 'Add Connection', + 'add Add Connection', + /Add\s*Connection/i, + 'add Add', + ], 'Add Connection', 10000); + } + if (!addClicked) throw new Error('Could not find Add Connection button'); // Click "I Understand, Continue" - triggers Google OAuth popup const popupPromise = page.waitForEvent('popup', { timeout: 15000 }); @@ -314,7 +333,7 @@ async function addAccount(browser, account, index, total, config) { } catch (err) { console.error(` [X] Failed: ${err.message}`); - try { await screenshot(page, `error-${account.email.replace(/[@.]/g, '_')}`); } catch {} + try { await screenshot(page, `error-${account.email.replace(/[@.]/g, '_')}`); } catch { } return { success: false, email: account.email, error: err.message }; } finally { await context.close();