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
Improve event listener tracking with more robust options handling
jonathan.qiu903943466c1a
diff --git a/browser_use/browser/context.py b/browser_use/browser/context.pyindex bfe18d680..7b2c5c206 100644--- a/browser_use/browser/context.py+++ b/browser_use/browser/context.py@@ -154,8 +154,13 @@ class BrowserSession:const originalAddEventListener = Element.prototype.addEventListener;const eventProxy = {- addEventListener: function (type, listener, options = { once: false, passive: false, capture: false }) {+ addEventListener: function (type, listener, options = {}) {// Initialize __listeners if not exists+ const defaultOptions = { once: false, passive: false, capture: false };+ if(typeof options === 'boolean') {+ options = { capture: options };+ }+ options = { ...defaultOptions, ...options };if (!this.__listeners) {this.__listeners = {};}@@ -164,6 +169,7 @@ class BrowserSession:if (!this.__listeners[type]) {this.__listeners[type] = [];}+// Add the listener to __listenersthis.__listeners[type].push({