28 lines
No EOL
1.2 KiB
Python
28 lines
No EOL
1.2 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": 1600, "height": 1100})
|
|
logs = []
|
|
pg.on("pageerror", lambda e: logs.append(f"PAGEERR {e}"))
|
|
pg.on("console", lambda m: logs.append(f"CONSOLE {m.text}") if m.type in ("error", "warning") else None)
|
|
pg.on("response", lambda r: logs.append(f"HTTP {r.status} {r.url}") if r.status >= 400 and "/api/" in r.url else None)
|
|
|
|
await pg.goto("https://parastoo.zebellkhan.com/", wait_until="networkidle", timeout=90000)
|
|
await pg.wait_for_timeout(5000)
|
|
|
|
# manual call to see the error detail
|
|
res = await pg.evaluate("""async () => {
|
|
try {
|
|
const r = await fetch('/api/team/hours?days=120');
|
|
const j = await r.json();
|
|
return {status: r.status, body: j};
|
|
} catch(e) { return {err: String(e)}; }
|
|
}""")
|
|
print("MANUAL FETCH:", json.dumps(res, ensure_ascii=False)[:600])
|
|
print("\nLOGS:", json.dumps(logs, ensure_ascii=False)[:800])
|
|
await b.close()
|
|
|
|
asyncio.run(main()) |