import puppeteer from 'puppeteer-extra'; import StealthPlugin from 'puppeteer-extra-plugin-stealth'; puppeteer.use(StealthPlugin()); async function testNoProxy() { let browser; try { console.log('🌐 Testing WITHOUT proxy...'); console.log(''); // NO PROXY browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'] }); const page = await browser.newPage(); const url = 'https://curaleaf.com/stores/curaleaf-dispensary-phoenix-airport/brands'; console.log('Going to:', url); await page.goto(url, { waitUntil: 'networkidle2', timeout: 60000 }); await page.waitForTimeout(3000); console.log('Current URL:', page.url()); if (page.url().includes('/age-gate')) { console.log('\n═══ HANDLING AGE GATE ═══'); // Click dropdown await page.waitForSelector('button[role="combobox"]', { timeout: 10000 }); await page.click('button[role="combobox"]'); console.log('āœ… Clicked dropdown'); await page.waitForTimeout(2000); // Take screenshot before clicking Arizona await page.screenshot({ path: '/tmp/before-arizona.png' }); console.log('šŸ“ø Screenshot saved: /tmp/before-arizona.png'); // Click Arizona option with real Puppeteer click const clicked = await page.evaluate(() => { const options = Array.from(document.querySelectorAll('[role="option"]')); const azOption = options.find(opt => opt.textContent?.toLowerCase().trim() === 'arizona' ) as HTMLElement; if (azOption) { azOption.click(); return true; } return false; }); console.log('āœ… Clicked Arizona:', clicked); // Wait for page to update await page.waitForTimeout(5000); // Take screenshot after await page.screenshot({ path: '/tmp/after-arizona.png' }); console.log('šŸ“ø Screenshot saved: /tmp/after-arizona.png'); console.log('Current URL:', page.url()); // Check page content const content = await page.evaluate(() => ({ title: document.title, text: document.body.innerText.substring(0, 500) })); console.log('\nPage title:', content.title); console.log('Page text:', content.text); } } catch (error: any) { console.error('āŒ Error:', error.message); } finally { if (browser) await browser.close(); } } testNoProxy();