You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using MultimodalWebSurfer, if clicking an element triggers a file download, the agent sometimes crashes with playwright._impl._errors.TargetClosedError during the sleep() call in PlaywrightController.
Although the code checks page.is_closed() before calling page.wait_for_timeout(), the page might still close between the check and the await due to the download handling behavior.
In cases where the browser cancels navigation after triggering a download (e.g., with net::ERR_ABORTED), the page closes, and an unhandled TargetClosedError is raised.
To Reproduce
Steps to reproduce the behavior..
Extend MultimodalWebSurfer or use it as-is.
Navigate to a webpage with a download link (e.g., a direct JSON, PDF or CSV download link).
Invoke a click_id() action on the download button.
Observe that after the click, during the sleep (sleep(page, duration)), a TargetClosedError is thrown.
Expected behavior
After triggering a download and closing the page or context, the agent should handle the closure gracefully.
It should not crash but should either:
Additional context
After a download is triggered, MultimodalWebSurfer continues with operations (like sleep) assuming the page still exists.
However, downloads can lead to canceled navigation and implicit page closure, which causes race conditions in Playwright.
Proposed solution: catch TargetClosedError specifically in sleep() and/or validate page state after downloads.
Which packages was the bug in?
Python Extensions (autogen-ext)
AutoGen library version.
Python 0.5.5
Other library version.
No response
Model used
gpt-4o
Model provider
Azure OpenAI
Other model provider
No response
Python version
3.12
.NET version
None
Operating system
Windows
The text was updated successfully, but these errors were encountered:
What happened?
Describe the bug
When using
MultimodalWebSurfer
, if clicking an element triggers a file download, the agent sometimes crashes withplaywright._impl._errors.TargetClosedError
during thesleep()
call inPlaywrightController
.Although the code checks
page.is_closed()
before callingpage.wait_for_timeout()
, the page might still close between the check and the await due to the download handling behavior.In cases where the browser cancels navigation after triggering a download (e.g., with
net::ERR_ABORTED
), the page closes, and an unhandledTargetClosedError
is raised.To Reproduce
Steps to reproduce the behavior..
MultimodalWebSurfer
or use it as-is.click_id()
action on the download button.sleep(page, duration)
), aTargetClosedError
is thrown.Expected behavior
After triggering a download and closing the page or context, the agent should handle the closure gracefully.
It should not crash but should either:
Example
Additional context
After a download is triggered,
MultimodalWebSurfer
continues with operations (like sleep) assuming the page still exists.However, downloads can lead to canceled navigation and implicit page closure, which causes race conditions in Playwright.
Proposed solution: catch
TargetClosedError
specifically insleep()
and/or validate page state after downloads.Which packages was the bug in?
Python Extensions (autogen-ext)
AutoGen library version.
Python 0.5.5
Other library version.
No response
Model used
gpt-4o
Model provider
Azure OpenAI
Other model provider
No response
Python version
3.12
.NET version
None
Operating system
Windows
The text was updated successfully, but these errors were encountered: