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
Fix bounds handling in DOMInteractedElement to return None if bounds are not set; ensure proper closure of agent service after execution.
Magnus Müllerd63292b3f239
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex bbc0ef22c..cd7dcf514 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -1814,6 +1814,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):self.logger.warning(f'{step_name} failed (attempt {retry_count}/{max_retries}), retrying...')await asyncio.sleep(delay_between_actions)+ await self.close()return resultsasync def _execute_initial_actions(self) -> None:diff --git a/browser_use/dom/views.py b/browser_use/dom/views.pyindex ea97c70b3..cbcaadaa1 100644--- a/browser_use/dom/views.py+++ b/browser_use/dom/views.py@@ -778,7 +778,7 @@ class DOMInteractedElement:'attributes': self.attributes,'x_path': self.x_path,'element_hash': self.element_hash,- 'bounds': self.bounds.to_dict(),+ 'bounds': self.bounds.to_dict() if self.bounds else None,}@classmethod