- 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>
77 lines
2.5 KiB
TypeScript
77 lines
2.5 KiB
TypeScript
import { firefox } from 'playwright';
|
|
import { getRandomProxy } from './src/utils/proxyManager.js';
|
|
|
|
async function testBrandsPage() {
|
|
const proxy = await getRandomProxy();
|
|
if (!proxy) {
|
|
console.log('❌ No proxy available');
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log(`🔐 Using proxy: ${proxy.server}`);
|
|
|
|
const browser = await firefox.launch({ headless: true });
|
|
|
|
const context = await browser.newContext({
|
|
viewport: { width: 1920, height: 1080 },
|
|
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
|
|
proxy: {
|
|
server: proxy.server,
|
|
username: proxy.username,
|
|
password: proxy.password
|
|
}
|
|
});
|
|
|
|
const page = await context.newPage();
|
|
|
|
try {
|
|
console.log('📍 Loading brands page...');
|
|
await page.goto('https://dutchie.com/embedded-menu/AZ-Deeply-Rooted/brands', {
|
|
waitUntil: 'domcontentloaded',
|
|
timeout: 45000
|
|
});
|
|
|
|
await page.waitForTimeout(5000);
|
|
|
|
// Try to find brand elements
|
|
const brandData = await page.evaluate(() => {
|
|
// Look for various brand-related selectors
|
|
const brandLinks = Array.from(document.querySelectorAll('a[href*="/brands/"], a[href*="/brand/"]'));
|
|
const allLinks = Array.from(document.querySelectorAll('a'));
|
|
const bodyText = document.body.textContent || '';
|
|
|
|
return {
|
|
brandLinkCount: brandLinks.length,
|
|
brandLinks: brandLinks.slice(0, 30).map(a => ({
|
|
href: a.getAttribute('href'),
|
|
text: a.textContent?.trim().substring(0, 100)
|
|
})),
|
|
totalLinks: allLinks.length,
|
|
pageTitle: document.title,
|
|
bodyTextPreview: bodyText.substring(0, 500)
|
|
};
|
|
});
|
|
|
|
console.log('\n📊 Brands Page Analysis:');
|
|
console.log(` Title: ${brandData.pageTitle}`);
|
|
console.log(` Total links: ${brandData.totalLinks}`);
|
|
console.log(` Brand links found: ${brandData.brandLinkCount}`);
|
|
console.log(`\n Sample brand links:`);
|
|
brandData.brandLinks.forEach((link, i) => {
|
|
console.log(` ${i + 1}. ${link.text} -> ${link.href}`);
|
|
});
|
|
console.log(`\n Page text preview:\n${brandData.bodyTextPreview}`);
|
|
|
|
// Take a screenshot for debugging
|
|
await page.screenshot({ path: '/tmp/brands-page.png', fullPage: true });
|
|
console.log('\n📸 Screenshot saved to /tmp/brands-page.png');
|
|
|
|
} catch (error: any) {
|
|
console.error('❌ Error:', error.message);
|
|
} finally {
|
|
await browser.close();
|
|
}
|
|
}
|
|
|
|
testBrandsPage();
|