69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
import { chromium } from 'playwright';
|
|
|
|
async function debugSolFlower() {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const context = await browser.newContext();
|
|
const page = await context.newPage();
|
|
|
|
try {
|
|
// Set age gate bypass cookies
|
|
await context.addCookies([
|
|
{
|
|
name: 'age_verified',
|
|
value: 'true',
|
|
domain: '.dutchie.com',
|
|
path: '/',
|
|
},
|
|
{
|
|
name: 'initial_location',
|
|
value: JSON.stringify({ state: 'Arizona' }),
|
|
domain: '.dutchie.com',
|
|
path: '/',
|
|
},
|
|
]);
|
|
|
|
console.log('🌐 Loading Sol Flower Sun City shop page...');
|
|
await page.goto('https://dutchie.com/dispensary/sol-flower-dispensary/shop', {
|
|
waitUntil: 'networkidle',
|
|
});
|
|
|
|
console.log('📸 Taking screenshot...');
|
|
await page.screenshot({ path: '/tmp/sol-flower-shop.png', fullPage: true });
|
|
|
|
// Try to find products with various selectors
|
|
console.log('\n🔍 Looking for products with different selectors:');
|
|
|
|
const selectors = [
|
|
'a[href*="/product/"]',
|
|
'[data-testid="product-card"]',
|
|
'[data-testid="product"]',
|
|
'.product-card',
|
|
'.ProductCard',
|
|
'article',
|
|
'[role="article"]',
|
|
];
|
|
|
|
for (const selector of selectors) {
|
|
const count = await page.locator(selector).count();
|
|
console.log(` ${selector}: ${count} elements`);
|
|
}
|
|
|
|
// Get the page HTML to inspect
|
|
console.log('\n📄 Page title:', await page.title());
|
|
|
|
// Check if there's any text indicating no products
|
|
const bodyText = await page.locator('body').textContent();
|
|
if (bodyText?.includes('No products') || bodyText?.includes('no items')) {
|
|
console.log('⚠️ Page indicates no products available');
|
|
}
|
|
|
|
console.log('\n✅ Screenshot saved to /tmp/sol-flower-shop.png');
|
|
} catch (error) {
|
|
console.error('❌ Error:', error);
|
|
} finally {
|
|
await browser.close();
|
|
}
|
|
}
|
|
|
|
debugSolFlower();
|