feat(driver): 增加元素高亮截图功能并重构截图矩阵

- 新增 `_get_highlighted_image` 核心逻辑,支持自动缩放 (Scale) 适配。
- 新增 `get_highlight_screenshot_as_file/bytes` 接口,支持诊断级高亮截图。
- 重构 `get_screenshot_as_file/bytes` 统一命名规范。
- 引入 `ImagePath` 与 `ImageBytes` 类型别名,增强代码语义化。
- 优化内存管理,使用 `io.BytesIO` 与 `img.load()` 确保在高频截图下的稳定性。
This commit is contained in:
2026-03-03 17:46:03 +08:00
parent b3dfd2f3e6
commit a8d0b75dd9
6 changed files with 180 additions and 22 deletions

View File

@@ -60,5 +60,7 @@ class HomePage(BasePage):
self.click(*self.login_button)
if self.wait_until_visible(*self.tv_name):
self.full_screen_screenshot("登陆成功")
self.get_screenshot_as_file("登陆成功")
self.get_highlight_screenshot_as_file(*self.tv_name, "登陆成功-高亮")
self.get_element_screenshot_as_file(*self.tv_name)
self.long_press(x=636, y=117, duration=300)