i can Connect to my existing Chrome installation to access saved states and cookies. by…
- User
i can Connect to my existing Chrome installation to access saved states and cookies. by running:
codeconfig = BrowserConfig( chrome_instance_path="C:\Program Files\Google\Chrome\Application\chrome.exe" )but how can i connect to my user data directory of my browser. "C:\Users\YourUsername\AppData\Local\Google\Chrome\User Data"
Assistant
Based on the provided repository files, I don't see direct documentation about configuring the user data directory. However, since browser-use is built on top of Playwright, you should be able to set the user data directory by adding it to the BrowserConfig.
Here's how you can likely connect to your Chrome user data directory:
pythonfrom browser_use import BrowserConfig config = BrowserConfig( chrome_instance_path="C:\Program Files\Google\Chrome\Application\chrome.exe", user_data_dir="C:\Users\YourUsername\AppData\Local\Google\Chrome\User Data" )However, I should note that:
- I don't see explicit documentation of this feature in the provided files
- You should be careful when using your actual Chrome profile as it may interfere with your regular browsing session
For the most accurate and up-to-date information about this functionality, I'd recommend:
- User
can i do this
chrome_instance_path=r"C:\Program Files\Google\Chrome\Application\chrome.exe", extra_chromium_args=[ r"--user-data-dir=C:\Users\YINL\AppData\Local\Google\Chrome\User Data" ] ) Assistant
Yes, that approach using
extra_chromium_argsis more likely to work! This is a more direct way to pass arguments to Chrome/Chromium.Here's the complete code you can use:
pythonfrom browser_use import BrowserConfig config = BrowserConfig( chrome_instance_path=r"C:\Program Files\Google\Chrome\Application\chrome.exe", extra_chromium_args=[ r"--user-data-dir=C:\Users\YINL\AppData\Local\Google\Chrome\User Data" ] )A few important notes:
- Using the
rprefix for the paths (raw strings) is good practice as it prevents issues with Windows backslashes - Make sure Chrome is completely closed before running your script, as Chrome doesn't allow multiple instances to use the same user data directory
- Be careful when using your main profile - it's generally safer to create a separate Chrome profile for automation
You can then use this config when creating your Agent:
python- Using the
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.