Skip to content

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

Should copy profile only for Chrome

kalil0321d592723be9ed
diff --git a/browser_use/browser/profile.py b/browser_use/browser/profile.py
index 8405955d4..a347a7942 100644
--- a/browser_use/browser/profile.py
+++ b/browser_use/browser/profile.py
@@ -785,6 +785,16 @@ class BrowserProfile(BrowserConnectArgs, BrowserLaunchPersistentContextArgs, Bro
# Already using a temp directory, no need to copy
return
+ is_chrome = (
+ 'chrome' in user_data_str.lower()
+ or (self.executable_path and 'chrome' in self.executable_path.name.lower())
+ or self.channel
+ in (BrowserChannel.CHROME, BrowserChannel.CHROME_BETA, BrowserChannel.CHROME_DEV, BrowserChannel.CHROME_CANARY)
+ )
+
+ if not is_chrome:
+ return
+
temp_dir = tempfile.mkdtemp(prefix='browser-use-user-data-dir-')
path_original_profile = Path(self.user_data_dir) / self.profile_directory
path_temp_profile = Path(temp_dir) / self.profile_directory