Files
tenderpilot/test-ted-selectors.mjs

33 lines
1.1 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);
// Save screenshot
await page.screenshot({ path: '/tmp/ted-screenshot.png', fullPage: false });
console.log('Screenshot saved to /tmp/ted-screenshot.png');
// Get page HTML sample
const bodyHTML = await page.evaluate(() => {
return document.body.innerHTML.substring(0, 5000);
});
console.log('\nFirst 5000 chars of body HTML:');
console.log(bodyHTML);
// Try to find any links to notices
const noticeLinks = await page.evaluate(() => {
const links = Array.from(document.querySelectorAll('a[href*="/notice/"], a[href*="Notice"]'));
return links.slice(0, 5).map(a => ({ href: a.href, text: a.textContent.trim().substring(0, 100) }));
});
console.log('\nFound notice links:', JSON.stringify(noticeLinks, null, 2));
await browser.close();