This commit is contained in:
Neo
2026-03-15 10:15:02 +08:00
parent 2dd217522c
commit 72bb11b34f
916 changed files with 65306 additions and 16102803 deletions

View File

@@ -0,0 +1,37 @@
"""一次性测试脚本H5 scrollTop=0 截图,用于确认 MCP 截图区域对齐。"""
import asyncio
from pathlib import Path
from playwright.async_api import async_playwright
ROOT = Path(__file__).resolve().parents[2]
async def main():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True, args=["--hide-scrollbars"])
ctx = await browser.new_context(
viewport={"width": 430, "height": 752}, device_scale_factor=3
)
page = await ctx.new_page()
await page.goto(
"http://127.0.0.1:5500/docs/h5_ui/pages/board-finance.html",
wait_until="load", timeout=15000,
)
await page.wait_for_timeout(2500)
await page.evaluate("""() => {
document.documentElement.style.overflow = 'auto';
document.documentElement.style.scrollbarWidth = 'none';
const s = document.createElement('style');
s.textContent = '::-webkit-scrollbar { display: none !important; }';
document.head.appendChild(s);
}""")
await page.wait_for_timeout(300)
await page.evaluate("() => { window.scrollTo({top: 0, behavior: 'instant'}); }")
await page.wait_for_timeout(500)
out = ROOT / "docs" / "h5_ui" / "screenshots" / "h5-board-finance--scroll0-test.png"
await page.screenshot(path=str(out), full_page=False)
info = await page.evaluate("() => ({ scrollY: window.scrollY, innerH: window.innerHeight })")
print(f"H5 scrollY={info['scrollY']}, innerHeight={info['innerH']}")
print(f"截图保存: {out}")
await browser.close()
asyncio.run(main())