Files
tenderpilot/test-ted-detail.mjs

45 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

import { chromium } from 'playwright';
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
const url = 'https://ted.europa.eu/en/search/result?q=&page=1&placeOfPerformanceCountry=GBR';
console.log('Loading:', url);
await page.goto(url, { waitUntil: 'networkidle', timeout: 30000 });
await page.waitForTimeout(3000);
// Extract full tender data
const tenders = await page.evaluate(() => {
const results = [];
const rows = document.querySelectorAll('tr[data-notice-id], .notice-row, tbody tr');
rows.forEach((row, idx) => {
if (idx > 5) return; // Limit to first 5 for testing
try {
const link = row.querySelector('a[href*="/notice/"]');
if (!link) return;
const cells = row.querySelectorAll('td');
const allText = row.textContent;
results.push({
href: link.href,
noticeId: link.textContent.trim(),
rowText: allText.trim().substring(0, 500),
cellCount: cells.length,
cellTexts: Array.from(cells).map(c => c.textContent.trim().substring(0, 100))
});
} catch (e) {
// Skip
}
});
return results;
});
console.log('\nExtracted tenders:', JSON.stringify(tenders, null, 2));
await browser.close();