[Add] browser-use and main.py
This commit is contained in:
parent
08e64bdf45
commit
96914d44ac
221 changed files with 30952 additions and 1 deletions
53
browser-use/docs/customize/real-browser.mdx
Normal file
53
browser-use/docs/customize/real-browser.mdx
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
title: "Connect to your Browser"
|
||||
description: "With this you can connect to your real browser, where you are logged in with all your accounts."
|
||||
icon: "computer"
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
You can connect the agent to your real Chrome browser instance, allowing it to access your existing browser profile with all your logged-in accounts and settings. This is particularly useful when you want the agent to interact with services where you're already authenticated.
|
||||
|
||||
<Note>
|
||||
First make sure to close all running Chrome instances.
|
||||
</Note>
|
||||
|
||||
## Basic Configuration
|
||||
|
||||
To connect to your real Chrome browser, you'll need to specify the path to your Chrome executable when creating the Browser instance:
|
||||
|
||||
```python
|
||||
from browser_use import Agent, Browser, BrowserConfig
|
||||
from langchain_openai import ChatOpenAI
|
||||
import asyncio
|
||||
# Configure the browser to connect to your Chrome instance
|
||||
browser = Browser(
|
||||
config=BrowserConfig(
|
||||
# Specify the path to your Chrome executable
|
||||
browser_binary_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', # macOS path
|
||||
# For Windows, typically: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'
|
||||
# For Linux, typically: '/usr/bin/google-chrome'
|
||||
)
|
||||
)
|
||||
|
||||
# Create the agent with your configured browser
|
||||
agent = Agent(
|
||||
task="Your task here",
|
||||
llm=ChatOpenAI(model='gpt-4o'),
|
||||
browser=browser,
|
||||
)
|
||||
|
||||
async def main():
|
||||
await agent.run()
|
||||
|
||||
input('Press Enter to close the browser...')
|
||||
await browser.close()
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
|
||||
<Note>
|
||||
When using your real browser, the agent will have access to all your logged-in sessions. Make sure to ALWAYS review the task you're giving to the agent and ensure it aligns with your security requirements!
|
||||
</Note>
|
||||
Loading…
Add table
Add a link
Reference in a new issue