主要改进: - 新增统一测试器 (universal_tester.py) 支持多种测试模式 - 优化测试报告生成器,支持汇总报告和操作截图 - 增强探索器 DFS 算法和状态指纹识别 - 新增智能测试配置 (smart_test.yaml) - 改进 AI 模型集成 (GLM/Gemini 支持) - 添加开发调试工具和文档
This commit is contained in:
54
debug_sidebar_structure.py
Normal file
54
debug_sidebar_structure.py
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
import os
|
||||
import json
|
||||
from src.browser.controller import BrowserController
|
||||
|
||||
def debug_sidebar():
|
||||
browser = BrowserController(headless=False)
|
||||
try:
|
||||
browser.start()
|
||||
browser.goto('http://47.99.105.253:8084')
|
||||
browser.wait(2000)
|
||||
|
||||
# Login
|
||||
print("Logging in...")
|
||||
browser.page.locator('input[placeholder*="用户名"]').fill('admin')
|
||||
browser.page.locator('input[type="password"]').fill('password')
|
||||
browser.page.locator('button:has-text("登录")').click()
|
||||
browser.wait(5000)
|
||||
|
||||
print(f"Current URL: {browser.page.url}")
|
||||
|
||||
# Capture sidebar structure
|
||||
sidebar_data = browser.page.evaluate('''() => {
|
||||
const getInfo = (el) => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
return {
|
||||
tag: el.tagName,
|
||||
text: el.innerText.split('\\n')[0].trim(),
|
||||
classes: el.className,
|
||||
visible: rect.width > 0 && rect.height > 0,
|
||||
rect: { x: rect.left, y: rect.top, w: rect.width, h: rect.height }
|
||||
};
|
||||
};
|
||||
|
||||
// Look for ant-menu or aside
|
||||
const sidebar = document.querySelector('.ant-layout-sider, aside, .ant-menu');
|
||||
if (!sidebar) return "Sidebar not found";
|
||||
|
||||
const items = Array.from(sidebar.querySelectorAll('.ant-menu-item, .ant-menu-submenu-title, a, button'));
|
||||
return items.map(getInfo);
|
||||
}''')
|
||||
|
||||
print("\nSidebar Elements Found:")
|
||||
if isinstance(sidebar_data, list):
|
||||
for item in sidebar_data:
|
||||
print(f"- [{item['tag']}] {item['text']} | Visible: {item['visible']} | Classes: {item['classes']}")
|
||||
else:
|
||||
print(sidebar_data)
|
||||
|
||||
finally:
|
||||
browser.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
debug_sidebar()
|
||||
Reference in New Issue
Block a user