33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
"""Дебаг панели: клик по каждому разделу, hash, начало DOM, ошибки консоли."""
|
|
import asyncio
|
|
import sys
|
|
|
|
from playwright.async_api import async_playwright
|
|
|
|
|
|
async def main(url="http://127.0.0.1:8078/"):
|
|
msgs = []
|
|
async with async_playwright() as p:
|
|
b = await p.chromium.launch()
|
|
pg = await b.new_page(viewport={"width": 1400, "height": 900})
|
|
pg.on("console", lambda m: msgs.append([m.type, m.text[:200]]))
|
|
pg.on("pageerror", lambda e: msgs.append(["pageerror", str(e)[:300]]))
|
|
await pg.goto(url, wait_until="domcontentloaded")
|
|
await pg.wait_for_selector(".kpi", timeout=20000)
|
|
for nid in ("feed", "abuse", "sources", "runs", "tg", "keys", "digest", "watch", "overview"):
|
|
await pg.click(f"[data-nav={nid}]")
|
|
await pg.wait_for_timeout(1600)
|
|
h = await pg.evaluate("() => location.hash")
|
|
head = (await pg.locator("#view").inner_text())[:180].replace("\n", " | ")
|
|
items = await pg.locator("#view .item").count()
|
|
rows = await pg.locator("#view table tbody tr").count()
|
|
print(f"[{nid}] hash={h!r} items={items} rows={rows}\n {head}")
|
|
print("\nCONSOLE:")
|
|
for m in msgs[-25:]:
|
|
print(" ", m)
|
|
await b.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main(*(sys.argv[1:] or [])))
|