Skip to content

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

Merge commit 'ad68c577c27cafb22270b811fbe9a0b9f4fcd521' into fix-disable-security-bug

Magnus Müller84db72b555cb
diff --cc browser_use/browser/profile.py
index 10fffe122,185b25108..7507d7203
--- a/browser_use/browser/profile.py
+++ b/browser_use/browser/profile.py
@@@ -747,35 -758,12 +758,40 @@@ class BrowserProfile(BrowserConnectArgs
if proxy_bypass:
pre_conversion_args.append(f'--proxy-bypass-list={proxy_bypass}')
+ # User agent flag
+ if self.user_agent:
+ pre_conversion_args.append(f'--user-agent={self.user_agent}')
+
- # convert to dict and back to dedupe and merge duplicate args
- final_args_list = BrowserLaunchArgs.args_as_list(BrowserLaunchArgs.args_as_dict(pre_conversion_args))
+ # Special handling for --disable-features to merge values instead of overwriting
+ # This prevents disable_security=True from breaking extensions by ensuring
+ # both default features (including extension-related) and security features are preserved
+ disable_features_values = []
+ non_disable_features_args = []
+
+ # Extract and merge all --disable-features values
+ for arg in pre_conversion_args:
+ if arg.startswith('--disable-features='):
+ features = arg.split('=', 1)[1]
+ disable_features_values.extend(features.split(','))
+ else:
+ non_disable_features_args.append(arg)
+
+ # Remove duplicates while preserving order
+ if disable_features_values:
+ unique_features = []
+ seen = set()
+ for feature in disable_features_values:
+ feature = feature.strip()
+ if feature and feature not in seen:
+ unique_features.append(feature)
+ seen.add(feature)
+
+ # Add merged disable-features back
+ non_disable_features_args.append(f'--disable-features={",".join(unique_features)}')
+
+ # convert to dict and back to dedupe and merge other duplicate args
+ final_args_list = BrowserLaunchArgs.args_as_list(BrowserLaunchArgs.args_as_dict(non_disable_features_args))
++
return final_args_list
def _get_extension_args(self) -> list[str]: