const { connect } = require('puppeteer-real-browser'); async function createAutzAccount() { console.log('Launching browser...'); const { browser, page } = await connect({ headless: 'auto', args: ['--no-sandbox', '--disable-setuid-sandbox'], turnstile: true }); let tempEmail = null; let tmailorPage = null; try { console.log('\n=== STEP 1: Get Temp Email from tmailor.com ==='); await page.goto('https://tmailor.com', { waitUntil: 'networkidle2', timeout: 60000 }); await new Promise(resolve => setTimeout(resolve, 3000)); const buttons = await page.$$('button, a'); for (const btn of buttons) { const text = await page.evaluate(el => el.textContent, btn); if (text && text.includes('New Email')) { console.log('Clicking New Email button...'); await btn.click(); await new Promise(resolve => setTimeout(resolve, 3000)); break; } } const emailInput = await page.$('input[readonly]'); if (emailInput) { tempEmail = await page.evaluate(el => el.value, emailInput); console.log('Got temp email:', tempEmail); } if (!tempEmail || !tempEmail.includes('@')) { throw new Error('Could not get temp email from tmailor'); } tmailorPage = page; console.log('\n=== STEP 2: Navigate to Autz.org ==='); const autzPage = await browser.newPage(); await autzPage.goto('https://autz.org/onboarding/qinw2ix?callback_url=https%3A%2F%2Fmy.zone.id%2F', { waitUntil: 'networkidle2', timeout: 60000 }); console.log('Page loaded, waiting for content...'); await new Promise(resolve => setTimeout(resolve, 3000)); await autzPage.screenshot({ path: 'autz-step1.png', fullPage: true }); console.log('Screenshot saved: autz-step1.png'); const pageText = await autzPage.evaluate(() => document.body.innerText); console.log('\n--- Page content (first 1000 chars) ---'); console.log(pageText.substring(0, 1000)); console.log('\n=== STEP 3: Look for email input field ==='); const emailSelectors = [ 'input[type="email"]', 'input[name="email"]', 'input[placeholder*="email" i]', 'input[id*="email" i]', 'input[type="text"]' ]; let emailField = null; for (const selector of emailSelectors) { emailField = await autzPage.$(selector); if (emailField) { console.log(`Found email field with selector: ${selector}`); break; } } if (emailField) { console.log(`Entering email: ${tempEmail}`); await emailField.click(); await emailField.type(tempEmail, { delay: 50 }); await new Promise(resolve => setTimeout(resolve, 1000)); } else { console.log('No email field found on page'); } console.log('\n=== STEP 4: Wait for Turnstile captcha ==='); console.log('Looking for Turnstile iframe...'); await new Promise(resolve => setTimeout(resolve, 2000)); const frames = autzPage.frames(); console.log(`Found ${frames.length} frames`); for (const frame of frames) { const url = frame.url(); console.log('Frame:', url); if (url.includes('turnstile') || url.includes('challenges')) { console.log('Found Turnstile frame! Waiting for it to solve...'); await new Promise(resolve => setTimeout(resolve, 5000)); } } console.log('Waiting for captcha to auto-solve...'); let captchaSolved = false; for (let i = 0; i < 30; i++) { await new Promise(resolve => setTimeout(resolve, 1000)); const html = await autzPage.content(); if (html.includes('Success') || html.includes('success') || html.includes('cf-turnstile-success')) { console.log('Captcha solved!'); captchaSolved = true; await new Promise(resolve => setTimeout(resolve, 2000)); break; } if (i % 5 === 0) { console.log(`Waiting for captcha... ${i + 1}/30`); } } if (!captchaSolved) { console.log('Captcha may not be fully solved, trying anyway...'); } await autzPage.screenshot({ path: 'autz-step2.png', fullPage: true }); console.log('Screenshot saved: autz-step2.png'); console.log('\n=== STEP 5: Click Continue button ==='); const continueBtn = await autzPage.$('button'); const allContinueBtns = await autzPage.$$('button'); for (const btn of allContinueBtns) { const text = await autzPage.evaluate(el => el.textContent, btn); if (text && text.includes('Continue')) { console.log('Found Continue button, clicking with mouse simulation...'); const box = await btn.boundingBox(); if (box) { await autzPage.mouse.click(box.x + box.width / 2, box.y + box.height / 2); console.log('Clicked at', box.x + box.width / 2, box.y + box.height / 2); } else { await btn.click(); } break; } } console.log('Waiting for page content to change...'); for (let i = 0; i < 10; i++) { await new Promise(resolve => setTimeout(resolve, 1000)); const text = await autzPage.evaluate(() => document.body.innerText); if (text.includes('Password') || text.includes('password')) { console.log('Registration form detected!'); break; } console.log(`Waiting... ${i + 1}/10`); } await new Promise(resolve => setTimeout(resolve, 2000)); await autzPage.screenshot({ path: 'autz-step3.png', fullPage: true }); console.log('Screenshot saved: autz-step3.png'); let pageText2 = await autzPage.evaluate(() => document.body.innerText); console.log('\n--- Page after Continue (first 1000 chars) ---'); console.log(pageText2.substring(0, 1000)); const currentUrl = autzPage.url(); console.log('Current URL:', currentUrl); if (pageText2.toLowerCase().includes('password') && pageText2.toLowerCase().includes('name')) { console.log('\n=== STEP 6: Fill out registration form ==='); const passwordField = await autzPage.$('input[type="password"], input[name="password"], input[placeholder*="password" i]'); if (passwordField) { const password = 'TestPass123!'; console.log('Entering password...'); await passwordField.click(); await passwordField.type(password, { delay: 30 }); } const allInputs = await autzPage.$$('input'); console.log(`Found ${allInputs.length} input fields`); for (const input of allInputs) { const inputType = await autzPage.evaluate(el => el.type, input); const inputName = await autzPage.evaluate(el => el.name || el.placeholder || '', input); const inputValue = await autzPage.evaluate(el => el.value, input); console.log(`Input: type=${inputType}, name/placeholder=${inputName}, value=${inputValue?.substring(0, 20)}`); if (inputName.toLowerCase().includes('name') && !inputName.toLowerCase().includes('email') && !inputValue) { console.log('Entering name...'); await input.click(); await input.type('Test User', { delay: 30 }); } if ((inputType === 'tel' || inputName.toLowerCase().includes('phone')) && !inputValue) { console.log('Entering phone...'); await input.click(); await input.type('+12025551234', { delay: 30 }); } } await autzPage.screenshot({ path: 'autz-step4-form.png', fullPage: true }); console.log('Screenshot saved: autz-step4-form.png'); console.log('Looking for Create Account button...'); const createBtn = await autzPage.$('button'); const allBtns = await autzPage.$$('button'); for (const btn of allBtns) { const text = await autzPage.evaluate(el => el.textContent, btn); if (text && (text.includes('Create Account') || text.includes('Register') || text.includes('Sign Up'))) { console.log('Clicking Create Account button...'); await btn.click(); await new Promise(resolve => setTimeout(resolve, 5000)); break; } } await autzPage.screenshot({ path: 'autz-step5-after-register.png', fullPage: true }); console.log('Screenshot saved: autz-step5-after-register.png'); const finalText = await autzPage.evaluate(() => document.body.innerText); console.log('\n--- Page after registration (first 1000 chars) ---'); console.log(finalText.substring(0, 1000)); } if (pageText2.toLowerCase().includes('code') || pageText2.toLowerCase().includes('verify') || pageText2.toLowerCase().includes('otp') || pageText2.toLowerCase().includes('sent') || pageText2.toLowerCase().includes('check your email')) { console.log('\nVerification code requested! Need to check email...'); } console.log('\n=== STEP 7: Check tmailor inbox for verification email ==='); await tmailorPage.bringToFront(); for (let attempt = 1; attempt <= 5; attempt++) { console.log(`\nChecking inbox, attempt ${attempt}/5...`); const refreshBtns = await tmailorPage.$$('button, a'); for (const btn of refreshBtns) { const text = await tmailorPage.evaluate(el => el.textContent, btn); if (text && (text.includes('Refresh') || text.includes('refresh'))) { await btn.click(); await new Promise(resolve => setTimeout(resolve, 3000)); break; } } const inboxText = await tmailorPage.evaluate(() => document.body.innerText); if (inboxText.toLowerCase().includes('autz') || inboxText.toLowerCase().includes('verify') || inboxText.toLowerCase().includes('zone')) { console.log('Found verification email!'); const emailLinks = await tmailorPage.$$('a, tr, div[class*="mail"], div[class*="message"]'); for (const link of emailLinks) { const linkText = await tmailorPage.evaluate(el => el.textContent, link); if (linkText && (linkText.toLowerCase().includes('autz') || linkText.toLowerCase().includes('verify') || linkText.toLowerCase().includes('zone'))) { console.log('Clicking on email...'); await link.click(); await new Promise(resolve => setTimeout(resolve, 3000)); break; } } break; } await new Promise(resolve => setTimeout(resolve, 5000)); } await tmailorPage.screenshot({ path: 'tmailor-inbox.png', fullPage: true }); console.log('Screenshot saved: tmailor-inbox.png'); console.log('\n=== FINAL STATUS ==='); console.log('Temp Email Used:', tempEmail); console.log('Check the screenshots to see the current state'); } catch (error) { console.error('Error:', error.message); await page.screenshot({ path: 'error-screenshot.png', fullPage: true }); } finally { await browser.close(); console.log('\nBrowser closed.'); } } createAutzAccount();