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:
@@ -75,7 +75,7 @@ class BasePage(CoreDriver):
|
||||
|
||||
:param label: 截图在报告中显示的名称
|
||||
"""
|
||||
path_str = self.full_screen_screenshot(name=label)
|
||||
path_str = self.get_screenshot_as_file(filename=label)
|
||||
|
||||
if path_str:
|
||||
img_path = Path(path_str)
|
||||
@@ -92,7 +92,7 @@ class BasePage(CoreDriver):
|
||||
|
||||
:param label: 截图在报告中显示的名称
|
||||
"""
|
||||
screenshot_bytes: bytes = self.driver.get_screenshot_as_png()
|
||||
screenshot_bytes: bytes = self.get_screenshot_as_bytes()
|
||||
|
||||
allure.attach(
|
||||
screenshot_bytes,
|
||||
|
||||
Reference in New Issue
Block a user