- 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>
126 lines
4.7 KiB
Python
126 lines
4.7 KiB
Python
"""
|
|
GUARDiA ITSM + 홈페이지 스크린샷 자동화 (sync Playwright)
|
|
"""
|
|
import sys, os
|
|
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
|
|
from pathlib import Path
|
|
from playwright.sync_api import sync_playwright, TimeoutError as PwTimeout
|
|
|
|
OUT_DIR = Path(r"C:\GUARDiA\workspace\zioinfo-web\frontend\public\screenshots")
|
|
OUT_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
ITSM_URL = "https://zioinfo.co.kr:8443"
|
|
HOME_URL = "https://zioinfo.co.kr"
|
|
ITSM_USER = "admin"
|
|
ITSM_PASS = "Admin@2026!"
|
|
|
|
results = []
|
|
|
|
def shot(page, name: str, full=False):
|
|
path = str(OUT_DIR / f"{name}.png")
|
|
page.screenshot(path=path, full_page=full)
|
|
size = Path(path).stat().st_size // 1024
|
|
print(f" OK {name}.png ({size} KB)")
|
|
results.append(name)
|
|
return path
|
|
|
|
def try_click(page, selectors: list, wait=1500):
|
|
for sel in selectors:
|
|
try:
|
|
el = page.locator(sel).first
|
|
if el.count() > 0:
|
|
el.click()
|
|
page.wait_for_timeout(wait)
|
|
return True
|
|
except Exception:
|
|
pass
|
|
return False
|
|
|
|
with sync_playwright() as pw:
|
|
browser = pw.chromium.launch(
|
|
headless=True,
|
|
args=["--ignore-certificate-errors", "--no-sandbox",
|
|
"--disable-blink-features=AutomationControlled"],
|
|
)
|
|
ctx = browser.new_context(
|
|
viewport={"width": 1440, "height": 900},
|
|
ignore_https_errors=True,
|
|
)
|
|
page = ctx.new_page()
|
|
page.set_default_timeout(20000)
|
|
|
|
# ── 1. ITSM 로그인 화면 ─────────────────────────────────────────────────
|
|
print("\n[ITSM] 로그인 화면")
|
|
try:
|
|
page.goto(f"{ITSM_URL}/", wait_until="domcontentloaded")
|
|
page.wait_for_timeout(2000)
|
|
shot(page, "01_itsm_login")
|
|
|
|
# 로그인 폼 입력
|
|
for sel in ["#username", "input[name=username]", "input[type=text]"]:
|
|
try:
|
|
page.fill(sel, ITSM_USER); break
|
|
except Exception: pass
|
|
|
|
for sel in ["#password", "input[name=password]", "input[type=password]"]:
|
|
try:
|
|
page.fill(sel, ITSM_PASS); break
|
|
except Exception: pass
|
|
|
|
page.keyboard.press("Enter")
|
|
page.wait_for_load_state("domcontentloaded")
|
|
page.wait_for_timeout(3000)
|
|
shot(page, "02_itsm_dashboard")
|
|
print(" -> 로그인 + 대시보드 OK")
|
|
|
|
except Exception as e:
|
|
print(f" ITSM 오류: {e}")
|
|
|
|
# ── 2. ITSM 주요 화면 ───────────────────────────────────────────────────
|
|
print("\n[ITSM] 주요 화면")
|
|
|
|
itsm_views = [
|
|
("SR 목록", [".nav-item[data-view='list']", "[data-view=list]"], "03_itsm_sr_list"),
|
|
("칸반 보드", [".nav-item[data-view='board']", "[data-view=board]"], "04_itsm_kanban"),
|
|
("감사 로그", [".nav-item[data-view='audit']", "[data-view=audit]"], "05_itsm_audit"),
|
|
]
|
|
for label, selectors, name in itsm_views:
|
|
try:
|
|
if try_click(page, selectors):
|
|
shot(page, name)
|
|
print(f" -> {label} OK")
|
|
else:
|
|
print(f" skip: {label}")
|
|
except Exception as e:
|
|
print(f" skip {label}: {e}")
|
|
|
|
# ── 3. 홈페이지 캡처 ────────────────────────────────────────────────────
|
|
print("\n[홈페이지] 주요 페이지")
|
|
home_pages = [
|
|
(HOME_URL, "06_home_main", True),
|
|
(HOME_URL + "/company/greeting", "07_home_greeting", False),
|
|
(HOME_URL + "/company/ci", "08_home_ci", False),
|
|
(HOME_URL + "/company/history", "09_home_history", False),
|
|
(HOME_URL + "/company/location", "10_home_location", False),
|
|
(HOME_URL + "/solution/guardia", "11_home_guardia", True),
|
|
(HOME_URL + "/business", "12_home_business", True),
|
|
(HOME_URL + "/recruit/jobs", "13_home_recruit", False),
|
|
(HOME_URL + "/contact", "14_home_contact", False),
|
|
]
|
|
for url, name, full in home_pages:
|
|
try:
|
|
page.goto(url, wait_until="domcontentloaded", timeout=20000)
|
|
page.wait_for_timeout(1800)
|
|
shot(page, name, full=full)
|
|
except PwTimeout:
|
|
print(f" timeout: {name}")
|
|
except Exception as e:
|
|
print(f" skip {name}: {e}")
|
|
|
|
browser.close()
|
|
|
|
print(f"\n=== 완료: {len(results)}개 스크린샷 ===")
|
|
for r in results:
|
|
print(f" {r}.png")
|