Skip to content

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

Fix framework events not firing correctly

Sophia Willows1206391e5930
diff --git a/browser_use/browser/watchdogs/default_action_watchdog.py b/browser_use/browser/watchdogs/default_action_watchdog.py
index 28c98ad00..bf4786e73 100644
--- a/browser_use/browser/watchdogs/default_action_watchdog.py
+++ b/browser_use/browser/watchdogs/default_action_watchdog.py
@@ -1174,7 +1174,7 @@ class DefaultActionWatchdog(BaseWatchdog):
try:
# Execute JavaScript to trigger comprehensive event sequence
framework_events_script = """
- (function() {
+ function() {
// Find the target element (available as 'this' when using objectId)
const element = this;
if (!element) return false;
@@ -1251,7 +1251,7 @@ class DefaultActionWatchdog(BaseWatchdog):
}
return success;
- })();
+ }
"""
# Execute the framework events script