Skip to content

The agent that grows with you

fix(browser): catch only the errors the hidden-tab activation can raise

Teknium42448157b19a
diff --git a/tools/browser_use_shot.py b/tools/browser_use_shot.py
index eb746774bf7..44c032dd000 100644
--- a/tools/browser_use_shot.py
+++ b/tools/browser_use_shot.py
@@ -39,7 +39,8 @@ def _bring_to_front_if_hidden(cdp: Callable[..., Any], current_tab: Callable[[],
if (state.get("result") or {}).get("value") != "hidden":
return
cdp("Target.activateTarget", targetId=current_tab()["targetId"])
- except Exception: # an engine without Target.activateTarget (Lightpanda) still captures below
+ # A CDP error (Lightpanda has no Target.activateTarget) or a slow IPC round trip: capture anyway.
+ except (RuntimeError, OSError, KeyError):
return