Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

close alias for BrowserSession stop thousands of users have attempted to use close, so why not add it

Laith Weinbergerc1eb87a35fd7
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index c2e799da6..390337753 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -721,6 +721,10 @@ class BrowserSession(BaseModel):
# Create fresh event bus
self.event_bus = EventBus()
+ async def close(self) -> None:
+ """Alias for stop()."""
+ await self.stop()
+
@observe_debug(ignore_input=True, ignore_output=True, name='browser_start_event_handler')
async def on_BrowserStartEvent(self, event: BrowserStartEvent) -> dict[str, str]:
"""Handle browser start request.