41 lines
No EOL
2.1 KiB
Python
41 lines
No EOL
2.1 KiB
Python
import asyncio, json
|
|
from playwright.async_api import async_playwright
|
|
|
|
async def main():
|
|
async with async_playwright() as p:
|
|
b = await p.chromium.launch(args=["--no-sandbox"])
|
|
pg = await b.new_page(viewport={"width": 393, "height": 852}, device_scale_factor=2, is_mobile=True)
|
|
await pg.goto("https://parastoo.zebellkhan.com/", wait_until="networkidle", timeout=90000)
|
|
await pg.wait_for_timeout(3000)
|
|
|
|
issues = await pg.evaluate("""() => {
|
|
const out = {
|
|
headerH: document.querySelector('.top')?.getBoundingClientRect().height,
|
|
tabsH: document.getElementById('tabs')?.getBoundingClientRect().height,
|
|
kpiGrid: (() => {
|
|
const cards = [...document.querySelectorAll('.kpi-grid .kpi, .kpi-grid > div, .stat-grid > div')];
|
|
return cards.map(c => ({w: Math.round(c.getBoundingClientRect().width), tag: c.className?.slice(0,20)}));
|
|
})(),
|
|
calGridCells: (() => {
|
|
const cells = [...document.querySelectorAll('.cal-grid .day')];
|
|
return cells.map(c => ({w: Math.round(c.getBoundingClientRect().width), h: Math.round(c.getBoundingClientRect().height)}));
|
|
})(),
|
|
fab: (() => {
|
|
const f = document.querySelector('.fab, [class*=fab], button[onclick*=openTask]');
|
|
if (!f) return null;
|
|
const r = f.getBoundingClientRect();
|
|
return {x: Math.round(r.x), y: Math.round(r.y), w: Math.round(r.width), visible: r.width > 0};
|
|
})(),
|
|
navChipsVisible: (() => {
|
|
const chips = [...document.querySelectorAll('.top-meta a.date-chip')];
|
|
return chips.map(c => ({text: c.innerText.trim(), visible: c.getBoundingClientRect().width > 0}));
|
|
})(),
|
|
bodyFontSize: getComputedStyle(document.body).fontSize,
|
|
viewportW: document.documentElement.clientWidth
|
|
};
|
|
return out;
|
|
}""")
|
|
print(json.dumps(issues, ensure_ascii=False, indent=2))
|
|
await b.close()
|
|
|
|
asyncio.run(main()) |