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
merge save_downloads_path and downloads_dir duplicate options
Nick Sweetinga85ae8ca3c3e
diff --git a/browser_use/agent/playwright_script_generator.py b/browser_use/agent/playwright_script_generator.pyindex 01e658a61..d769fc53b 100644--- a/browser_use/agent/playwright_script_generator.py+++ b/browser_use/agent/playwright_script_generator.py@@ -116,7 +116,7 @@# 'height': self.context_config.window_height,# }-# # Note: cookies_file and save_downloads_path are handled separately+# # Note: cookies_file and downloads_dir are handled separately# # Filter out None values# options_dict = {k: v for k, v in options_dict.items() if v is not None}@@ -438,8 +438,8 @@# index = params.get('index')# selector = self._get_selector_for_action(history_item, action_index_in_step)# download_dir_in_script = "'./files'" # Default-# if self.context_config and self.context_config.save_downloads_path:-# download_dir_in_script = repr(self.context_config.save_downloads_path)+# if self.context_config and self.context_config.downloads_dir:+# download_dir_in_script = repr(self.context_config.downloads_dir)# script_lines = []# if selector and index is not None:diff --git a/browser_use/browser/profile.py b/browser_use/browser/profile.pyindex 864f77049..ed129dcca 100644--- a/browser_use/browser/profile.py+++ b/browser_use/browser/profile.py@@ -586,7 +586,6 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Broprofile_directory: str = 'Default' # e.g. 'Profile 1', 'Profile 2', 'Custom Profile', etc.save_recording_path: str | None = Field(default=None, description='Directory for video recordings.')- save_downloads_path: str | None = Field(default=None, description='Directory for saving downloads.')save_har_path: str | None = Field(default=None, description='Directory for saving HAR files.')trace_path: str | None = Field(default=None, description='Directory for saving trace files.')@@ -606,6 +605,7 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Brodownloads_dir: Path | str = Field(default=Path('~/.config/browseruse/downloads').expanduser(),description='Directory for downloads.',+ validation_alias=AliasChoices('save_downloads_path'),)# uploads_dir: Path | None = Field(default=None, description='Directory for uploads (defaults to downloads_dir if not set).')diff --git a/docs/customize/browser-settings.mdx b/docs/customize/browser-settings.mdxindex 84739892e..407a9517c 100644--- a/docs/customize/browser-settings.mdx+++ b/docs/customize/browser-settings.mdx@@ -312,15 +312,9 @@ File to save cookies to.downloads_dir: Path | str = '~/.config/browseruse/downloads'```-Directory for downloads.+Directory to save browser downloads in.-#### `save_downloads_path`--```python-save_downloads_path: str | None = None-```--Directory for saving downloads (alternative to downloads_dir).+(previously called `save_downloads_path` in some places)#### `profile_directory`@@ -328,7 +322,7 @@ Directory for saving downloads (alternative to downloads_dir).profile_directory: str = 'Default'```-Chrome profile directory name (e.g., 'Profile 1', 'Profile 2').+Chrome profile subdirectory name inside of your `user_data_dir` (e.g. `Default`, `Profile 1`, `Work`, etc.).#### `window_position`diff --git a/examples/features/download_file.py b/examples/features/download_file.pyindex 7051c74cd..6a68d2477 100644--- a/examples/features/download_file.py+++ b/examples/features/download_file.py@@ -20,7 +20,7 @@ if not api_key:llm = ChatGoogleGenerativeAI(model='gemini-2.0-flash-exp', api_key=SecretStr(api_key))browser_session = BrowserSession(browser_profile=BrowserProfile(- save_downloads_path=os.path.join(os.path.expanduser('~'), 'downloads'),+ downloads_dir='~/Downloads',user_data_dir='~/.config/browseruse/profiles/default',))