feat: 实现AI驱动的Web自动化测试框架
Some checks failed
AI Web Tester CI / test (push) Has been cancelled

主要功能:
- 纯视觉元素定位 + DOM辅助的混合方案
- 解决 mouse.click() 与 Vue 页面交互问题
- 使用 elementFromPoint + JS click/focus 实现可靠点击
- 智能元素定位: 根据描述生成CSS选择器获取精确坐标
- 区域扫描作为后备定位方案
- 完整的测试报告生成 (HTML+JSON)
- 截图记录每个操作步骤

技术改进:
- controller.py: 改进 click_at 使用 JavaScript 交互
- executor.py: 添加 _find_element_by_description 智能定位
- planner.py: 增强 prompt 传入视口尺寸
- main.py: 获取实际视口大小传给 planner
This commit is contained in:
empty
2025-12-28 15:34:22 +08:00
commit a67ad26a52
24 changed files with 2137 additions and 0 deletions

22
example.py Normal file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env python3
"""
Example: AI Web Tester Demo
"""
import sys
sys.path.insert(0, ".")
from src import WebTester
def main():
# Example 1: Basic usage with context manager
with WebTester(model="claude") as tester:
tester.goto("http://47.99.105.253:8084")
result = tester.test("找到登录信息输入框,填入 账号admin 密码password进行登录")
print(f"Test completed: {result['steps']} steps")
print(f"Report: {result['report']}")
result = tester.test("在登录后的首页,查看所有可以点击的功能,建立功能清单")
if __name__ == "__main__":
main()