测试 x2

设置最长截图等待时间,避免报错,至少把图截出来。
This commit is contained in:
2026-04-21 22:17:45 +08:00
parent 4e7893409a
commit 6719be85db

View File

@@ -24,8 +24,10 @@ class ScreenShot(PlayContextManager):
async def shot(self, save_path: str) -> None: async def shot(self, save_path: str) -> None:
await self.page.mouse.move(0, 0) await self.page.mouse.move(0, 0)
await self.page.wait_for_load_state("networkidle") try:
await self.page.screenshot(path=save_path) await self.page.wait_for_load_state("networkidle", timeout=1000)
finally:
await self.page.screenshot(path=save_path)
logger.debug(f"截图 | 截图已经保存在 {save_path=}") logger.debug(f"截图 | 截图已经保存在 {save_path=}")
return return