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(browser): preserve default Chrome arg order
Growth Radar QAdf2701e52481
diff --git a/browser_use/browser/profile.py b/browser_use/browser/profile.pyindex 1e0e82fb3..c5f4b737a 100644--- a/browser_use/browser/profile.py+++ b/browser_use/browser/profile.py@@ -907,7 +907,8 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Bro"""Get the list of all Chrome CLI launch args for this profile (compiled from defaults, user-provided, and system-specific)."""if isinstance(self.ignore_default_args, list):- default_args = set(CHROME_DEFAULT_ARGS) - set(self.ignore_default_args)+ ignored_default_args = set(self.ignore_default_args)+ default_args = [arg for arg in CHROME_DEFAULT_ARGS if arg not in ignored_default_args]elif self.ignore_default_args is True:default_args = []elif not self.ignore_default_args:diff --git a/tests/ci/test_profile_args.py b/tests/ci/test_profile_args.pynew file mode 100644index 000000000..592995ecd--- /dev/null+++ b/tests/ci/test_profile_args.py@@ -0,0 +1,32 @@+from browser_use.browser.profile import CHROME_DEFAULT_ARGS, BrowserProfile+++def test_get_args_keeps_default_order_when_ignoring_default_args(tmp_path):+ profile = BrowserProfile(+ user_data_dir=tmp_path,+ ignore_default_args=['--disable-popup-blocking', '--no-default-browser-check'],+ enable_default_extensions=False,+ )++ args = profile.get_args()++ expected_defaults = [+ arg for arg in CHROME_DEFAULT_ARGS if arg not in {'--disable-popup-blocking', '--no-default-browser-check'}+ ]+ actual_defaults = [arg for arg in args if arg in CHROME_DEFAULT_ARGS]++ assert actual_defaults == expected_defaults+ assert '--disable-popup-blocking' not in args+ assert '--no-default-browser-check' not in args+++def test_get_args_keeps_default_order_with_default_ignored_args(tmp_path):+ profile = BrowserProfile(user_data_dir=tmp_path, enable_default_extensions=False)++ args = profile.get_args()++ ignored_default_args = profile.ignore_default_args if isinstance(profile.ignore_default_args, list) else []+ expected_defaults = [arg for arg in CHROME_DEFAULT_ARGS if arg not in ignored_default_args]+ actual_defaults = [arg for arg in args if arg in CHROME_DEFAULT_ARGS]++ assert actual_defaults == expected_defaults