-
Couldn't load subscription status.
- Fork 45
Description
Hi! The A5 is amazing, simplify the use of the Browser-use. But, how about the download of files? When I insert a prompt what contain download command, a download of a file with stranger code nome is showing in the download's log of the Chrome, but the file demanded dont transfer trully in the Download folder. Have any way to fix this?
In my use of the common Browser-Use, reading the documentation, I use suggested changes and arrived at this code, which works. Although the temp file still appears with a strange code in the Chrome download log, when looking in the Downloads folder, the files are there. Here is the code as I am using it in the common Browser-User with OpenAI API:
---------------------------------------------------------------------------CODE START----------------------------------------------------
import asyncio
import os
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from pydantic import SecretStr
from browser_use import Agent
from browser_use.browser.browser import Browser, BrowserConfig
from browser_use.browser.context import BrowserContextConfig
load_dotenv()
browser = Browser(
config=BrowserConfig(
new_context_config=BrowserContextConfig(save_downloads_path=os.path.join(os.path.expanduser('~'), 'downloads'))
, chrome_instance_path='C:\Program Files\Google\Chrome\Application\chrome.exe')
)
async def run_download():
agent = Agent(
task=('Go to "https://file-examples.com/" and download the smallest doc file.'),
llm=ChatOpenAI(model='gpt-4o'),
max_actions_per_step=8,
use_vision=True,
browser=browser,
)
await agent.run(max_steps=25)
await browser.close()
if name == 'main':
asyncio.run(run_download())
---------------------------------------------------------------------------CODE END------------------------------------------------------