Skip to content

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

fix user_data_dir not expanded in chrome_launch_args

CR Li0d63cbb25d21
diff --git a/browser_use/browser/browser.py b/browser_use/browser/browser.py
index 76e095a98..182bdab9a 100644
--- a/browser_use/browser/browser.py
+++ b/browser_use/browser/browser.py
@@ -225,7 +225,8 @@ class Browser:
try:
# ~/.config/browseruse/profiles/default
user_data_dir = Path('~/.config') / 'browseruse' / 'profiles' / 'default'
- user_data_dir.expanduser().mkdir(parents=True, exist_ok=True)
+ user_data_dir = user_data_dir.expanduser()
+ user_data_dir.mkdir(parents=True, exist_ok=True)
except Exception as e:
logger.error(f'❌ Failed to create ~/.config/browseruse directory: {type(e).__name__}: {e}')
user_data_dir = fallback_user_data_dir