Skip to content

Automate browser based workflows with AI

skip exception if pre block screenshot failed (#3652)

LawyZheng1424c25f431c
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py
index 2c19066d4..3c452a492 100644
--- a/skyvern/forge/sdk/workflow/models/block.py
+++ b/skyvern/forge/sdk/workflow/models/block.py
@@ -344,13 +344,21 @@ class Block(BaseModel, abc.ABC):
if not browser_state:
LOG.warning("No browser state found when creating workflow_run_block", workflow_run_id=workflow_run_id)
else:
- screenshot = await browser_state.take_fullpage_screenshot(
- use_playwright_fullpage=app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
- "ENABLE_PLAYWRIGHT_FULLPAGE",
- workflow_run_id,
- properties={"organization_id": str(organization_id)},
+ try:
+ screenshot = await browser_state.take_fullpage_screenshot(
+ use_playwright_fullpage=app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
+ "ENABLE_PLAYWRIGHT_FULLPAGE",
+ workflow_run_id,
+ properties={"organization_id": str(organization_id)},
+ )
)
- )
+ except Exception:
+ LOG.warning(
+ "Failed to take screenshot before executing the block, ignoring the exception",
+ workflow_run_id=workflow_run_id,
+ workflow_run_block_id=workflow_run_block_id,
+ )
+ screenshot = None
if screenshot:
await app.ARTIFACT_MANAGER.create_workflow_run_block_artifact(
workflow_run_block=workflow_run_block,