Spaces:
Sleeping
Sleeping
File size: 920 Bytes
d7b3d84 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import asyncio
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
from dotenv import load_dotenv
load_dotenv()
from browser_use import Agent, Browser, ChatGoogle
# Connect to your existing Chrome browser
browser = Browser(
executable_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
user_data_dir='~/Library/Application Support/Google/Chrome',
profile_directory='Default',
)
# NOTE: You have to close all Chrome browsers before running this example so that we can launch chrome in debug mode.
async def main():
# save storage state
agent = Agent(
llm=ChatGoogle(model='gemini-flash-latest'),
# Google blocks this approach, so we use a different search engine
task='go to amazon.com and search for pens to draw on whiteboards',
browser=browser,
)
await agent.run()
if __name__ == '__main__':
asyncio.run(main())
|