Files
homepage_relaunch/scripts/tabs-test.mjs
T
2026-10-09 14:00:40 +02:00

18 lines
978 B
JavaScript

import { chromium } from 'playwright';
const [,, url, out] = process.argv;
const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
await page.goto(url, { waitUntil: 'networkidle' });
const tabs = page.locator('[role="tab"]');
await tabs.nth(0).focus();
await page.keyboard.press('ArrowDown');
await page.waitForTimeout(500);
const selected = await page.evaluate(() => Array.from(document.querySelectorAll('[role="tab"]')).map(t => t.getAttribute('aria-selected')));
const activeImg = await page.evaluate(() => Array.from(document.querySelectorAll('[data-stage-item]')).map(p => p.hasAttribute('data-active')));
const focused = await page.evaluate(() => document.activeElement?.textContent?.trim());
console.log({ selected, activeImg, focused });
await page.locator('#sectors').scrollIntoViewIfNeeded();
await page.waitForTimeout(600);
await page.screenshot({ path: out, fullPage: false });
await browser.close();