diff --git a/README.md b/README.md
index 1a3bea2f4..ac21ef1da 100644
--- a/README.md
+++ b/README.md
@@ -84,8 +84,8 @@ Check out the [library docs](https://docs.browser-use.com) and [cloud docs](http
https://github.com/user-attachments/assets/171fb4d6-0355-46f2-863e-edb04a828d04
-See more [examples in the docs](https://docs.browser-use.com/examples).
+See [more examples](https://docs.browser-use.com/examples) and give us a star!
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 18a6570bb..17d57449f 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -68,6 +68,7 @@ from browser_use.tools.service import Tools
from browser_use.utils import (
URL_PATTERN,
_log_pretty_path,
+ check_latest_browser_use_version,
get_browser_use_version,
get_git_info,
time_execution_async,
@@ -1175,13 +1176,20 @@ class Agent(Generic[Context, AgentStructuredOutput]):
# Just re-raise - Pydantic's validation errors are already descriptive
raise
- def _log_agent_run(self) -> None:
+ async def _log_agent_run(self) -> None:
"""Log the agent run"""
# Blue color for task
self.logger.info(f'\033[34m🚀 Task: {self.task}\033[0m')
self.logger.debug(f'🤖 Browser-Use Library Version {self.version} ({self.source})')
+ # Check for latest version and log upgrade message if needed
+ latest_version = await check_latest_browser_use_version()
+ if latest_version and latest_version != self.version:
+ self.logger.info(
+ f'📦 Newer version available: {latest_version} (current: {self.version}). Upgrade with: uv add browser-use@{latest_version}'
+ )
+
def _log_first_step_startup(self) -> None:
"""Log startup message only on the first step"""
if len(self.history.history) == 0:
@@ -1406,7 +1414,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):
signal_handler.register()
try:
- self._log_agent_run()
+ await self._log_agent_run()
self.logger.debug(
f'🔧 Agent setup: Agent Session ID {self.session_id[-4:]}, Task ID {self.task_id[-4:]}, Browser Session ID {self.browser_session.id[-4:] if self.browser_session else "None"} {"(connecting via CDP)" if (self.browser_session and self.browser_session.cdp_url) else "(launching local browser)"}'
diff --git a/browser_use/browser/watchdogs/default_action_watchdog.py b/browser_use/browser/watchdogs/default_action_watchdog.py
index 263420c5e..b420e6054 100644
--- a/browser_use/browser/watchdogs/default_action_watchdog.py
+++ b/browser_use/browser/watchdogs/default_action_watchdog.py
@@ -1179,8 +1179,8 @@ class DefaultActionWatchdog(BaseWatchdog):
# Execute JavaScript to trigger comprehensive event sequence
framework_events_script = """
(function() {
- // Find the target element
- const element = arguments[0];
+ // Find the target element (available as 'this' when using objectId)
+ const element = this;
if (!element) return false;
// Ensure element is focused
@@ -1255,7 +1255,7 @@ class DefaultActionWatchdog(BaseWatchdog):
}
return success;
- })(arguments[0]);
+ })();
"""
# Execute the framework events script
@@ -1263,7 +1263,6 @@ class DefaultActionWatchdog(BaseWatchdog):
params={
'objectId': object_id,
'functionDeclaration': framework_events_script,
- 'arguments': [{'objectId': object_id}],
'returnByValue': True,
},
session_id=cdp_session.session_id,
diff --git a/browser_use/utils.py b/browser_use/utils.py
index 35f9a9db0..efd4d2a18 100644
--- a/browser_use/utils.py
+++ b/browser_use/utils.py
@@ -13,6 +13,7 @@ from sys import stderr
from typing import Any, ParamSpec, TypeVar
from urllib.parse import urlparse
+import httpx
from dotenv import load_dotenv
load_dotenv()
@@ -578,6 +579,24 @@ def get_browser_use_version() -> str:
return 'unknown'
+async def check_latest_browser_use_version() -> str | None:
+ """Check the latest version of browser-use from PyPI asynchronously.
+
+ Returns:
+ The latest version string if successful, None if failed
+ """
+ try:
+ async with httpx.AsyncClient(timeout=3.0) as client:
+ response = await client.get('https://pypi.org/pypi/browser-use/json')
+ if response.status_code == 200:
+ data = response.json()
+ return data['info']['version']
+ except Exception:
+ # Silently fail - we don't want to break agent startup due to network issues
+ pass
+ return None
+
+
@cache
def get_git_info() -> dict[str, str] | None:
"""Get git information if installed from git repository"""