gendesign/tradein-mvp/scripts/test-playwright.py
lekss361 d2a0257639
All checks were successful
Deploy Trade-In / changes (push) Successful in 6s
Deploy Trade-In / build-backend (push) Has been skipped
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / deploy (push) Successful in 32s
feat(tradein-scripts): scrapers + probes + Phase C improvements (#551)
2026-05-24 19:58:38 +00:00

34 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Minimal Playwright test — открывает Chrome окно с Avito на 30 sec."""
import asyncio
from playwright.async_api import async_playwright
async def go():
async with async_playwright() as p:
print("launching browser...", flush=True)
browser = await p.chromium.launch(headless=False)
print("browser launched, opening page...", flush=True)
page = await browser.new_page()
try:
await page.goto(
"https://www.avito.ru/ekaterinburg/kvartiry/prodam-ASgBAgICAUSSA8YQ?s=104&p=1",
timeout=30000,
)
except Exception as e:
print(f"goto FAIL: {type(e).__name__}: {e}", flush=True)
await asyncio.sleep(15)
await browser.close()
return
print("page loaded", flush=True)
try:
title = await page.title()
print(f"title: {title}", flush=True)
except Exception as e:
print(f"title FAIL: {e}", flush=True)
print("окно должно быть видно ~30 сек", flush=True)
await asyncio.sleep(30)
await browser.close()
if __name__ == "__main__":
asyncio.run(go())