Update bot.js

This commit is contained in:
2026-07-01 08:21:51 +00:00
parent 7061970eff
commit bfbba49239
+22 -3
View File
@@ -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();