plugins/navManager:导航 CRUD + 导航分类 CRUD(独立 blueprint) plugins/friendManager:友情链接 CRUD plugins/aboutManager:关于本站 CRUD plugins/siteStats:访问统计主页 + JSON 接口 + /site/* GET 埋点 + nav 卡片点击埋点 applications/view/public/nav.py:导航聚合页 / 分类详情 / JSON 接口,支持 visit_count 注入 applications/view/public/about.py:关于本站公开页 applications/view/public/friend.py:友情链接公开页 templates/public/base.html:响应式首页(搜索框 / 分类抽屉 / 5 主题切换 / footer 隐私小字) templates/public/index.html / category.html:卡片右下角访问次数 templates/public/about.html / friend.html:关于 + 友链前台页 docs/plugins-development.md:插件开发完整指南(生命周期 + 4 个示例 + FAQ + framework 迁移) scripts/:探针与端到端验证脚本(probe_*/verify_*/test_*)
56 lines
2.3 KiB
Python
56 lines
2.3 KiB
Python
"""调试主题按钮点击"""
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
with sync_playwright() as pw:
|
|
browser = pw.chromium.launch(headless=True, args=['--no-sandbox', '--disable-gpu'])
|
|
ctx = browser.new_context(viewport={'width':1440,'height':900})
|
|
page = ctx.new_page()
|
|
|
|
msgs = []
|
|
page.on('console', lambda m: msgs.append(f'[{m.type}] {m.text}'))
|
|
page.on('pageerror', lambda e: msgs.append(f'[PAGE-ERR] {e}'))
|
|
|
|
page.goto('http://192.168.1.10:5000/', wait_until='networkidle')
|
|
page.wait_for_timeout(800)
|
|
|
|
print('=== 1. 检查按钮存在 ===')
|
|
btn_count = page.locator('#theme-toggle').count()
|
|
print(f' #theme-toggle count: {btn_count}')
|
|
btn_html = page.locator('#theme-toggle').evaluate('el => el.outerHTML') if btn_count else 'N/A'
|
|
print(f' btn html: {btn_html[:200]}')
|
|
|
|
print('=== 2. 检查菜单存在 ===')
|
|
menu_count = page.locator('#theme-menu').count()
|
|
print(f' #theme-menu count: {menu_count}')
|
|
if menu_count:
|
|
menu_html = page.locator('#theme-menu').evaluate('el => el.outerHTML.substring(0, 300)')
|
|
print(f' menu html: {menu_html}')
|
|
|
|
print('=== 3. 检查菜单项 ===')
|
|
items = page.locator('.theme-menu li').count()
|
|
print(f' li count: {items}')
|
|
|
|
print('=== 4. 检查 z-index / 遮挡 ===')
|
|
btn_box = page.locator('#theme-toggle').bounding_box()
|
|
print(f' btn box: {btn_box}')
|
|
menu_box = page.locator('#theme-menu').bounding_box()
|
|
print(f' menu box (closed): {menu_box}')
|
|
|
|
print('=== 5. 点击按钮 ===')
|
|
page.click('#theme-toggle')
|
|
page.wait_for_timeout(500)
|
|
|
|
print(' menu open class:', page.locator('#theme-menu').evaluate('el => el.className'))
|
|
print(' menu opacity:', page.locator('#theme-menu').evaluate('el => window.getComputedStyle(el).opacity'))
|
|
print(' menu pointer-events:', page.locator('#theme-menu').evaluate('el => window.getComputedStyle(el).pointerEvents'))
|
|
print(' menu display:', page.locator('#theme-menu').evaluate('el => window.getComputedStyle(el).display'))
|
|
print(' menu visibility:', page.locator('#theme-menu').evaluate('el => window.getComputedStyle(el).visibility'))
|
|
|
|
box2 = page.locator('#theme-menu').bounding_box()
|
|
print(f' menu box (after click): {box2}')
|
|
|
|
print('=== 6. 控制台 / 错误日志 ===')
|
|
for m in msgs[-30:]:
|
|
print(' ', m)
|
|
|
|
browser.close() |