16 lines
915 B
JavaScript
16 lines
915 B
JavaScript
import { chromium } from 'playwright';
|
|
const browser = await chromium.launch();
|
|
const page = await browser.newPage({ viewport: { width: 1280, height: 950 } });
|
|
await page.goto('http://localhost:5186/en/weather/week/berlin/', { waitUntil: 'load', timeout: 120000 });
|
|
await page.waitForTimeout(14000);
|
|
|
|
// scroll right down to the footer and click a link there
|
|
await page.evaluate(() => { const m = document.querySelector('main'); m.scrollTop = m.scrollHeight; });
|
|
await page.waitForTimeout(700);
|
|
const before = await page.evaluate(() => document.querySelector('main').scrollTop);
|
|
await page.locator('footer a[href*="/weather/14-day"]').first().click();
|
|
await page.waitForTimeout(7000);
|
|
const after = await page.evaluate(() => document.querySelector('main').scrollTop);
|
|
console.log(JSON.stringify({ scrollBeforeClick: Math.round(before), scrollAfterNav: Math.round(after), url: page.url() }));
|
|
await browser.close();
|