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

- 优化 is_visible,支持快速状态检查。
- 新增 wait_until_visible/wait_until_not_visible 支持元素状态检查。
- 新增 clear_popups 支持弹窗清理。
- 优化 implicit_wait 状态追踪,确保等待时间恢复的准确性。
- 更新 README.md
- 其他优化
[clear_popups 采用“非阻塞探测 + 阻塞确认”策略,大幅提升清理效率并减少无效等待]
This commit is contained in:
2026-01-29 18:15:48 +08:00
parent f1d1a5d35f
commit d3f9326baa
7 changed files with 312 additions and 130 deletions

View File

@@ -23,9 +23,9 @@ LOG_DIR = OUTPUT_DIR / "logs"
LOG_BACKUP_DIR = LOG_DIR / "backups"
ALLURE_TEMP = BASE_DIR / "temp"
REPORT_DIR = BASE_DIR / "report"
SCREENSHOT_DIR = OUTPUT_DIR / "screenshots"
# 确保必要的目录存在
for folder in [LOG_DIR, LOG_BACKUP_DIR, ALLURE_TEMP]:
for folder in [LOG_DIR, LOG_BACKUP_DIR, ALLURE_TEMP, SCREENSHOT_DIR]:
folder.mkdir(parents=True, exist_ok=True)
# --- 文件路径 ---
@@ -46,4 +46,21 @@ ANDROID_CAPS = {
"deviceName": "Android",
"appPackage": "com.android.settings",
"appActivity": ".Settings",
"noReset": False
}
# ANDROID_CAPS = {
# "platformName": "Android",
# "automationName": "uiautomator2",
# "deviceName": "Android",
# "appPackage": "com.bocionline.ibmp",
# "appActivity": "com.bocionline.ibmp.app.main.launcher.LauncherActivity",
# "noReset":False
# }
IOS_CAPS = {
"platformName": "iOS",
"automationName": "XCUITest",
"autoAcceptAlerts": True, # 自动接受系统权限请求
"waitForQuiescence": False, # 设为 False 可加速扫描
# 如果是某些特定的业务弹窗 autoAcceptAlerts 无效,
# 此时就会触发我们代码里的 PopupManager.solve()
}