zioinfo-mail/scripts/misc/playwright_home.py
DESKTOP-TKLFCPR\ython 28d3ba4836 refactor(cleanup): commit folder reorganization - scripts/, _archive/, docs/ restructure
- Move backend/frontend/messenger/ old paths to _archive/
- Reorganize scripts into scripts/deploy, check, push, setup, misc
- Move docs (pptx, docx) to docs/
- Add .claude agents and skills for fullstack/folder-cleanup harness
- workspace/ projects remain intact

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 19:43:09 +09:00

83 lines
3.3 KiB
Python

"""홈페이지 + ITSM 주요화면 스크린샷 (동기, 오류 최소화)"""
import sys
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
from pathlib import Path
from playwright.sync_api import sync_playwright
OUT = Path(r"C:\GUARDiA\workspace\zioinfo-web\frontend\public\screenshots")
OUT.mkdir(parents=True, exist_ok=True)
HOME = "https://zioinfo.co.kr"
ITSM = "https://zioinfo.co.kr:8443"
captured = []
def snap(page, name, full=False):
p = str(OUT / f"{name}.png")
page.screenshot(path=p, full_page=full)
kb = Path(p).stat().st_size // 1024
print(f" [{name}] {kb}KB")
captured.append(name)
with sync_playwright() as pw:
br = pw.chromium.launch(
headless=True,
args=["--ignore-certificate-errors","--no-sandbox","--disable-dev-shm-usage"],
)
ctx = br.new_context(viewport={"width":1440,"height":900}, ignore_https_errors=True)
pg = ctx.new_page()
pg.set_default_timeout(25000)
# ── ITSM 로그인 & 대시보드 ─────────────────────────────────────────────
print("[ITSM]")
pg.goto(ITSM, wait_until="domcontentloaded")
pg.wait_for_timeout(2000)
snap(pg, "itsm_01_login")
pg.locator("input").first.fill("admin")
pg.locator("input[type=password]").first.fill("Admin@2026!")
pg.keyboard.press("Enter")
pg.wait_for_timeout(3000)
snap(pg, "itsm_02_dashboard")
# 사이드바 nav 클릭 시도
nav_items = pg.locator("#sidebar-nav .nav-item, #sidebar-nav [data-view]").all()
print(f" nav items: {len(nav_items)}")
for i, item in enumerate(nav_items[:6]):
try:
view = item.get_attribute("data-view") or f"item{i}"
item.click()
pg.wait_for_timeout(1200)
snap(pg, f"itsm_03_{view}")
except Exception as e:
print(f" skip nav {i}: {e}")
# ── 홈페이지 ──────────────────────────────────────────────────────────
print("\n[홈페이지]")
pages = [
(HOME, "home_01_main", True),
(HOME+"/company/greeting", "home_02_greeting", False),
(HOME+"/company/ci", "home_03_ci", False),
(HOME+"/company/history", "home_04_history", False),
(HOME+"/company/organization", "home_05_org", False),
(HOME+"/company/location", "home_06_location", False),
(HOME+"/solution/guardia", "home_07_guardia", True),
(HOME+"/business", "home_08_business", True),
(HOME+"/news/newsroom", "home_09_news", False),
(HOME+"/recruit/jobs", "home_10_recruit", False),
(HOME+"/contact", "home_11_contact", False),
]
for url, name, full in pages:
try:
pg.goto(url, wait_until="domcontentloaded", timeout=20000)
pg.wait_for_timeout(1500)
snap(pg, name, full)
except Exception as e:
print(f" skip {name}: {str(e)[:60]}")
br.close()
print(f"\n=== 캡처 완료: {len(captured)}개 ===")
for c in captured:
print(f" {c}.png")