Check if video exists before assignment (#1788)

This commit is contained in:
Maksim Ivanov
2025-02-18 16:51:35 +01:00
committed by GitHub
parent ad7de04dc5
commit 71cbd27b7e

View File

@@ -482,7 +482,8 @@ class BrowserState:
if self.browser_artifacts.video_artifacts[index].video_path is None: if self.browser_artifacts.video_artifacts[index].video_path is None:
try: try:
async with asyncio.timeout(settings.BROWSER_ACTION_TIMEOUT_MS / 1000): async with asyncio.timeout(settings.BROWSER_ACTION_TIMEOUT_MS / 1000):
self.browser_artifacts.video_artifacts[index].video_path = await page.video.path() if page.video:
self.browser_artifacts.video_artifacts[index].video_path = await page.video.path()
except asyncio.TimeoutError: except asyncio.TimeoutError:
LOG.info("Timeout to get the page video, skip the exception") LOG.info("Timeout to get the page video, skip the exception")
except Exception: except Exception:
@@ -495,7 +496,8 @@ class BrowserState:
) )
try: try:
async with asyncio.timeout(settings.BROWSER_ACTION_TIMEOUT_MS / 1000): async with asyncio.timeout(settings.BROWSER_ACTION_TIMEOUT_MS / 1000):
self.browser_artifacts.video_artifacts[index].video_path = await page.video.path() if page.video:
self.browser_artifacts.video_artifacts[index].video_path = await page.video.path()
except asyncio.TimeoutError: except asyncio.TimeoutError:
LOG.info("Timeout to get the page video, skip the exception") LOG.info("Timeout to get the page video, skip the exception")
except Exception: except Exception: