Skip to content

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

Update browser_use/browser/session.py

Nick Sweetingaeaa58fa0bd6
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index c13ad8d5e..32ffd60fc 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -1691,7 +1691,7 @@ class BrowserSession(BaseModel):
# Check both formats: --user-data-dir=/path and --user-data-dir /path
for i, arg in enumerate(cmdline):
# Combined format: --user-data-dir=/path
- if arg.startswith('--user-data-dir=') and arg.split('=', 1)[1] == target_dir:
+ if arg.startswith('--user-data-dir=') and str(Path(arg.split('=', 1)[1]).expanduser().resolve()) == target_dir:
return True
# Separate format: --user-data-dir /path
elif arg == '--user-data-dir' and i + 1 < len(cmdline) and cmdline[i + 1] == target_dir: