Raise screenshot error earlier when page is closed (#1108)

This commit is contained in:
Shuchang Zheng
2024-11-01 10:43:24 -07:00
committed by GitHub
parent 252ea7922e
commit 690dd4c2e8
2 changed files with 22 additions and 0 deletions

View File

@@ -1,3 +1,23 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [title: 'Workato'](#title-workato)
- [Running a Skyvern Task in Workato](#running-a-skyvern-task-in-workato)
- [Setup](#setup)
- [Configure](#configure)
- [Test](#test)
- [Running a Skyvern Workflow in Workato](#running-a-skyvern-workflow-in-workato)
- [Setup](#setup-1)
- [Configure](#configure-1)
- [Test](#test-1)
- [Adding a Previously Ran Task or Workflow in Workato](#adding-a-previously-ran-task-or-workflow-in-workato)
- [Setup](#setup-2)
- [Configure](#configure-2)
- [Test](#test-2)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
---
title: 'Workato'
---

View File

@@ -39,6 +39,8 @@ class SkyvernFrame:
file_path: str | None = None,
timeout: float = SettingsManager.get_settings().BROWSER_LOADING_TIMEOUT_MS,
) -> bytes:
if page.is_closed():
raise FailedToTakeScreenshot(error_message="Page is closed")
try:
await page.wait_for_load_state(timeout=SettingsManager.get_settings().BROWSER_LOADING_TIMEOUT_MS)
LOG.debug("Page is fully loaded, agent is about to take screenshots")