This allows you to automate your existing Chrome browser, so you’re already logged into your websites.
You may need to fully close Chrome before running these examples. Additionally, if Google search blocks automated browsers, use DuckDuckGo or other search engines instead.
Basic Example
import asyncio
from browser_use import Agent, Browser, ChatOpenAI
# Auto-selects first available Chrome profile
browser = Browser.from_system_chrome()
agent = Agent(
task='Visit https://duckduckgo.com and search for "browser-use founders"',
browser=browser,
llm=ChatOpenAI(model='gpt-4.1-mini'),
)
async def main():
await agent.run()
if __name__ == "__main__":
asyncio.run(main())
Choosing a Profile
Chrome supports multiple profiles. List and select the one you want:
from browser_use import Browser
# List available profiles
profiles = Browser.list_chrome_profiles()
for p in profiles:
print(f"{p['directory']}: {p['name']}")
# Output:
# Profile 1: Work
# Profile 5: Personal
# Use a specific profile
browser = Browser.from_system_chrome(profile_directory='Profile 5')
Manual Path Configuration
If auto-detection doesn’t work, specify paths manually:
browser = Browser(
executable_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
user_data_dir='~/Library/Application Support/Google/Chrome',
profile_directory='Default',
)
How it Works
Browser.from_system_chrome() automatically detects:
| Platform | Executable Path | User Data Directory |
|---|
| macOS | /Applications/Google Chrome.app/Contents/MacOS/Google Chrome | ~/Library/Application Support/Google/Chrome |
| Windows | C:\Program Files\Google\Chrome\Application\chrome.exe | %LocalAppData%\Google\Chrome\User Data |
| Linux | /usr/bin/google-chrome or /usr/bin/chromium | ~/.config/google-chrome |