- 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>
76 lines
2.6 KiB
TypeScript
76 lines
2.6 KiB
TypeScript
import { chromium } from 'playwright';
|
|
import { bypassAgeGatePlaywright } from './src/utils/age-gate-playwright';
|
|
|
|
async function exploreCuraleafMenu() {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const context = await browser.newContext({
|
|
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
|
viewport: { width: 1280, height: 720 }
|
|
});
|
|
|
|
const page = await context.newPage();
|
|
|
|
try {
|
|
console.log('Loading Curaleaf and bypassing age gate...\n');
|
|
await page.goto('https://curaleaf.com/stores/curaleaf-dispensary-48th-street');
|
|
await page.waitForTimeout(2000);
|
|
await bypassAgeGatePlaywright(page, 'Arizona');
|
|
await page.waitForTimeout(3000);
|
|
|
|
console.log('Current URL:', page.url());
|
|
console.log('\nLooking for menu navigation...\n');
|
|
|
|
// Look for "View Menu", "Shop Now", "Order Online" type links
|
|
const menuSelectors = [
|
|
'a:has-text("View Menu")',
|
|
'a:has-text("Shop Now")',
|
|
'a:has-text("Order Online")',
|
|
'a:has-text("Browse Menu")',
|
|
'button:has-text("View Menu")',
|
|
'button:has-text("Shop Now")'
|
|
];
|
|
|
|
for (const selector of menuSelectors) {
|
|
const count = await page.locator(selector).count();
|
|
if (count > 0) {
|
|
console.log(`Found: ${selector} (${count} elements)`);
|
|
const element = page.locator(selector).first();
|
|
const href = await element.getAttribute('href').catch(() => null);
|
|
const text = await element.textContent();
|
|
console.log(` Text: ${text}`);
|
|
console.log(` Link: ${href}`);
|
|
|
|
if (href) {
|
|
console.log(`\n✅ Found menu link! Clicking to see where it goes...`);
|
|
await element.click();
|
|
await page.waitForTimeout(5000);
|
|
console.log(` New URL: ${page.url()}\n`);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Check if the URL changed
|
|
const currentUrl = page.url();
|
|
if (currentUrl.includes('menu') || currentUrl.includes('shop')) {
|
|
console.log(`✅ Navigated to menu page: ${currentUrl}\n`);
|
|
|
|
// Now look for products
|
|
await page.waitForTimeout(3000);
|
|
const productCount = await page.locator('[data-testid^="product"], .product-card, [class*="ProductCard"]').count();
|
|
console.log(`Products found: ${productCount}`);
|
|
}
|
|
|
|
// Take final screenshot
|
|
await page.screenshot({ path: '/tmp/curaleaf-menu-exploration.png', fullPage: true });
|
|
console.log('\n📸 Screenshot saved: /tmp/curaleaf-menu-exploration.png');
|
|
|
|
} catch (error) {
|
|
console.error('Error:', error);
|
|
} finally {
|
|
await browser.close();
|
|
}
|
|
}
|
|
|
|
exploreCuraleafMenu();
|