Android UI inspection and automation tool
Reason this release was yanked:
测试版不通过
Project description
🔍 Android View Scope
现代化的Android UI元素检查器,类似weditor的功能,基于Vue.js 3 + FastAPI构建
✨ 特性
- 🚀 现代化技术栈 - Vue.js 3 + Element Plus + FastAPI
- [DEVICE]设备管理 - 自动检测和管理Android设备
- 🖼️ 实时截图 - 高质量PNG截图获取
- 🎯 交互式元素选择 - SVG交互层,点击选择UI元素
- 📊 UI层次结构 - 完整的界面层次树显示
- 💻 代码生成 - 自动生成uiautomator2定位代码
- 🔧 多种定位策略 - Resource-ID、文本、XPath等多种方式
🏗️ 项目结构
viewscope/
├── frontend/ # Vue.js 3 前端项目
│ ├── src/
│ │ ├── views/ # 页面组件
│ │ ├── stores/ # 状态管理 (Pinia)
│ │ └── components/
│ ├── package.json
│ └── vite.config.js
├── backend/ # FastAPI 后端项目
│ ├── main.py # 应用入口
│ ├── core/ # 核心模块
│ │ ├── device_manager.py # 设备管理
│ │ ├── ui_analyzer.py # UI分析
│ │ └── code_generator.py # 代码生成
│ ├── api/ # API路由
│ │ ├── devices.py
│ │ ├── screenshot.py
│ │ └── ...
│ └── requirements.txt
├── start.bat # 一键启动脚本
└── README.md
🚀 快速开始
一键启动 (推荐)
双击运行 start.bat 脚本,会自动:
- 启动后端API服务 (端口8000)
- 安装前端依赖 (如果需要)
- 启动前端开发服务器 (端口8080)
手动启动
后端启动
cd backend
pip install -r requirements.txt
python main.py
前端启动
cd frontend
npm install
npm run dev
📋 前置要求
系统要求
- Windows 10/11
- Python 3.8+
- Node.js 16+
- 已安装Android SDK (ADB可用)
设备要求
- Android 4.4+
- 开启USB调试
- 设备已通过ADB连接
验证环境
# 检查Python
python --version
# 检查Node.js
node --version
# 检查ADB
adb version
# 检查设备连接
adb devices
🎯 使用方法
-
启动应用
- 运行
start.bat或手动启动前后端 - 浏览器打开 http://localhost:8080
- 运行
-
连接设备
- 在顶部工具栏选择设备
- 点击"刷新当前视图"按钮
-
元素选择
- 在截图上点击任意UI元素
- 右侧面板显示元素详细信息
-
代码生成
- 切换到"代码生成"标签页
- 查看自动生成的uiautomator2代码
- 点击"复制代码"按钮
-
UI层次查看
- 切换到"UI层次"标签页
- 浏览完整的界面树状结构
- 使用搜索功能定位特定元素
🔧 API文档
启动后端服务后,访问 http://localhost:8000/docs 查看完整的API文档。
主要接口
GET /api/devices- 获取设备列表POST /api/screenshot- 截图并获取UI结构GET /api/ui-hierarchy- 获取UI层次结构POST /api/code/generate- 生成定位代码
🐛 故障排除
常见问题
-
设备检测不到
# 检查ADB连接 adb devices # 重启ADB服务 adb kill-server adb start-server
-
截图失败
- 确保设备已授权USB调试
- 检查设备是否锁屏
- 尝试重新连接设备
-
前端无法访问后端
- 检查后端是否在8000端口启动
- 确认防火墙设置
- 查看浏览器控制台错误
-
依赖安装失败
# Python依赖 pip install -r requirements.txt -i https://pypi.douban.com/simple # Node.js依赖 npm install --registry=https://registry.npm.taobao.org
🛠️ 开发说明
技术栈
- 前端: Vue.js 3, Element Plus, SVG, Pinia
- 后端: FastAPI, uiautomator2, Pillow
- 构建工具: Vite, Python uvicorn
开发环境
# 后端热重载
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# 前端热重载
npm run dev
📦 构建部署
前端构建
cd frontend
npm run build
后端打包
cd backend
pip install pyinstaller
pyinstaller --onefile main.py
🤝 贡献指南
- Fork 本仓库
- 创建功能分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 打开 Pull Request
📄 许可证
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情
🙏 致谢
- uiautomator2 - Android自动化框架
- Vue.js - 渐进式JavaScript框架
- FastAPI - 现代Python Web框架
- Element Plus - Vue.js UI组件库
如有问题或建议,欢迎提Issue或Pull Request!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file viewscope-1.0.1.tar.gz.
File metadata
- Download URL: viewscope-1.0.1.tar.gz
- Upload date:
- Size: 460.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5264f7270de4c4daa3c52087f4ab1e16201dd886ab0482f3711b8ce7e0f0af54
|
|
| MD5 |
9335c1a2ee83c4645b0384c2085d3455
|
|
| BLAKE2b-256 |
9e97bef634bafabb496d4e39bd6d7ac0a3b53c61fc29eda06954a3f01e8097bd
|
File details
Details for the file viewscope-1.0.1-py3-none-any.whl.
File metadata
- Download URL: viewscope-1.0.1-py3-none-any.whl
- Upload date:
- Size: 468.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2392478ae74f648c61e42494145b386776db102e79ecb34ff4d4816bb964000f
|
|
| MD5 |
66194a3db9e0c69ec680e684068b772f
|
|
| BLAKE2b-256 |
2d2e7e17ecc186be9e288df06a9f8def3a634c2cf3f3d3f53f5cf491c855775b
|