Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
fixed UnionType type error
Gregor Žunič1e93ca5a9f2c
diff --git a/browser_use/controller/registry/service.py b/browser_use/controller/registry/service.pyindex 6680312fd..9737661b4 100644--- a/browser_use/controller/registry/service.py+++ b/browser_use/controller/registry/service.py@@ -5,6 +5,7 @@ import loggingimport refrom collections.abc import Callablefrom inspect import Parameter, iscoroutinefunction, signature+from types import UnionTypefrom typing import Any, Generic, Optional, TypeVar, Union, get_args, get_originfrom pydantic import BaseModel, Field, RootModel, create_model@@ -39,7 +40,7 @@ class Registry(Generic[Context]):self.telemetry = ProductTelemetry()self.exclude_actions = exclude_actions if exclude_actions is not None else []- def _get_special_param_types(self) -> dict[str, type | None]:+ def _get_special_param_types(self) -> dict[str, type | UnionType | None]:"""Get the expected types for special parameters from SpecialActionParameters"""# Manually define the expected types to avoid issues with Optional handling.# we should try to reduce this list to 0 if possible, give as few standardized objects to all the actions