gendesign/tradein-mvp/scripts/test-playwright.py
lekss361 70e45ce5e9 feat(tradein-scripts): scrapers, probes, Phase C improvements
New scripts:
- avito-playwright-sweep.py — Playwright-based Avito sweep (bypasses Qrator)
- backfill-yandex-addresses-ekb.py — fill street-only listings.address с house number
- local-sweep-ekb-{cian,yandex,}.py — full ЕКБ sweep through residential IP
- probe-* — quick diagnostics (region leak, migration status, parser filter, db counts)
- inspect-{houses,search}-html.py — Avito DOM structure analysis
- test-playwright.py — minimal Playwright smoke

Phase C script updates (backfill-house-imv.py):
- Pipe avito_imv module logs to avito-raw.log file (env AVITO_LOG_PATH override)
- Clamp rooms=0 (studio) → 1 — Avito IMV API rejects rooms=0 with HTTP 400
2026-05-24 22:49:20 +03: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())