- Add backend stale process monitoring API (/api/stale-processes) - Add users management route - Add frontend landing page and stale process monitor UI on /scraper-tools - Move old development scripts to backend/archive/ - Update frontend build with new features 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
79 lines
2.5 KiB
TypeScript
79 lines
2.5 KiB
TypeScript
import puppeteer from 'puppeteer-extra';
|
|
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
|
|
import { Browser, Page } from 'puppeteer';
|
|
|
|
puppeteer.use(StealthPlugin());
|
|
|
|
async function debugAgeGateElements() {
|
|
let browser: Browser | null = null;
|
|
|
|
try {
|
|
const url = 'https://curaleaf.com/stores/curaleaf-az-48th-street';
|
|
|
|
browser = await puppeteer.launch({
|
|
headless: 'new',
|
|
args: [
|
|
'--no-sandbox',
|
|
'--disable-setuid-sandbox',
|
|
'--disable-dev-shm-usage',
|
|
'--disable-blink-features=AutomationControlled'
|
|
]
|
|
});
|
|
|
|
const page = await browser.newPage();
|
|
await page.setViewport({ width: 1920, height: 1080 });
|
|
await page.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');
|
|
|
|
console.log('Loading page...');
|
|
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
|
|
await page.waitForTimeout(5000); // Wait for React to render
|
|
|
|
const elements = await page.evaluate(() => {
|
|
const allClickable = Array.from(document.querySelectorAll('button, a, div[role="button"], [onclick]'));
|
|
|
|
return {
|
|
buttons: Array.from(document.querySelectorAll('button')).map(b => ({
|
|
text: b.textContent?.trim(),
|
|
classes: b.className,
|
|
id: b.id
|
|
})),
|
|
links: Array.from(document.querySelectorAll('a')).map(a => ({
|
|
text: a.textContent?.trim(),
|
|
href: a.href,
|
|
classes: a.className
|
|
})),
|
|
divs: Array.from(document.querySelectorAll('div[role="button"], div[onclick], [class*="card"], [class*="Card"], [class*="state"], [class*="State"]')).slice(0, 20).map(d => ({
|
|
text: d.textContent?.trim().substring(0, 100),
|
|
classes: d.className,
|
|
role: d.getAttribute('role')
|
|
}))
|
|
};
|
|
});
|
|
|
|
console.log('\n=== BUTTONS ===');
|
|
elements.buttons.forEach((b, i) => {
|
|
console.log(`${i + 1}. "${b.text}" [${b.classes}] #${b.id}`);
|
|
});
|
|
|
|
console.log('\n=== LINKS ===');
|
|
elements.links.slice(0, 10).forEach((a, i) => {
|
|
console.log(`${i + 1}. "${a.text}" -> ${a.href}`);
|
|
});
|
|
|
|
console.log('\n=== DIVS/CARDS ===');
|
|
elements.divs.forEach((d, i) => {
|
|
console.log(`${i + 1}. "${d.text}" [${d.classes}] role=${d.role}`);
|
|
});
|
|
|
|
await browser.close();
|
|
process.exit(0);
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
if (browser) await browser.close();
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
debugAgeGateElements();
|