const { chromium } = require('playwright');
(async () => {
  const b = await chromium.launch({ args: ['--ignore-certificate-errors'] });
  const p = await b.newPage({ viewport: { width: 1200, height: 1400 }, ignoreHTTPSErrors: true, deviceScaleFactor: 2 });
  await p.goto('https://farmer.taild3aaf6.ts.net/fea/evangelio-de-cada-dia/', { waitUntil: 'networkidle' });
  const m = await p.evaluate(() => ({
    date: document.querySelector('.fea-eed-date')?.textContent,
    tabs: [...document.querySelectorAll('.fea-eed-labels label')].map(l=>l.textContent),
    nav: [...document.querySelectorAll('.fea-eed-nav')].map(a=>a.textContent.trim()),
    textoVisible: getComputedStyle(document.querySelector('.fea-eed-panel-texto')).display,
    videoVisible: getComputedStyle(document.querySelector('.fea-eed-panel-video')).display,
    hasIframe: !!document.querySelector('.fea-eed-panel-video iframe'),
  }));
  console.log(JSON.stringify(m,null,2));
  await p.screenshot({ path: '/tmp/eed_texto.png', fullPage: false });
  // click video tab
  await p.click('label[for=fed-video]');
  await p.waitForTimeout(300);
  await p.screenshot({ path: '/tmp/eed_video.png', fullPage: false });
  await b.close();
})();
