24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
import { chromium } from 'playwright';
|
|
const browser = await chromium.launch();
|
|
const ctx = await browser.newContext({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true, deviceScaleFactor: 2 });
|
|
const page = await ctx.newPage();
|
|
await page.goto('https://yslootahrobotics.com/', { waitUntil: 'networkidle', timeout: 60000 });
|
|
await page.waitForSelector('footer', { timeout: 30000 });
|
|
await page.waitForTimeout(3000);
|
|
const r = await page.evaluate(() => {
|
|
const footer = document.querySelector('footer');
|
|
if (!footer) return { error: 'no footer' };
|
|
const body = document.body;
|
|
const fRect = footer.getBoundingClientRect();
|
|
return {
|
|
bodyScrollHeight: body.scrollHeight,
|
|
footerBottomAbs: Math.round(fRect.bottom + window.scrollY),
|
|
spaceBelowFooter: Math.round(body.scrollHeight - (fRect.bottom + window.scrollY)),
|
|
bodyDisplay: getComputedStyle(body).display,
|
|
bodyMinHeight: getComputedStyle(body).minHeight,
|
|
footerMarginTop: getComputedStyle(footer).marginTop,
|
|
};
|
|
});
|
|
console.log(JSON.stringify(r, null, 2));
|
|
await browser.close();
|