feat(core,utils): 新增CoreDriver基础操作,更新文档

- 新增 switch_to_webview/switch_to_native 切换视图。
- 新增 config_loader.py 配置文件系统
- 优化 conftest.py,支持获取设备信息和默认参数。
- 优化 run_appium.py
- 更新 README.md
- 其他优化
This commit is contained in:
2026-02-06 17:28:04 +08:00
parent 483a31793d
commit 52758940ed
13 changed files with 495 additions and 199 deletions

28
utils/data_loader.py Normal file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env python
# coding=utf-8
"""
@author: CNWei,ChenWei
@Software: PyCharm
@contact: t6g888@163.com
@file: data_loader
@date: 2026/1/27 10:00
@desc: 数据加载工具
"""
import yaml
from pathlib import Path
from typing import Any, List
def load_yaml(file_path: Path | str) -> dict[str, Any] | List[Any]:
"""
加载 YAML 文件
:param file_path: 文件路径
:return: 数据字典或列表
"""
path = Path(file_path)
if not path.exists():
raise FileNotFoundError(f"YAML file not found: {path}")
with open(path, "r", encoding="utf-8") as f:
return yaml.safe_load(f)