browser-use
browser-use copied to clipboard
Local instance of Chrome not running well
Bug Description
I am trying to use browser-use with my local instance of chrome but i keep getting the following errors:
INFO [agent] 📍 Step 1 ERROR [browser] Failed to update state: Page.screenshot: Protocol error (Page.captureScreenshot): Cannot take screenshot with 0 width. Call log:
- taking page screenshot
-
- disabled all CSS animations -
- waiting for fonts to load...
-
- fonts loaded
And then in my terminal, I get this error:
[90214:259:0310/165034.809255:ERROR:new_tab_ui.cc(55)] Requested load of chrome://newtab/ for incorrect profile type.
I run this debug statement in my terminal prior to all of this as well:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
Reproduction Steps
- Just run browser-use with your local chrome instance by pointing it to chrome_instance_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
- Run the debugging statement in your terminal as follows: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
- Run your agent and observe the error
Fyi I am using claude 3.5 and openai 4o
Code Sample
async def main():
# Persist the browser state across agents
browser = Browser(
config=BrowserConfig(
headless=False,
chrome_instance_path='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', # Adjust this path for your OS
)
)
async with await browser.new_context() as context:
model = ChatAnthropic(model_name='claude-3-5-sonnet-20240620', timeout=25, stop=None, temperature=0.3)
openaimodel = ChatOpenAI(model='gpt-4o')
# Initialize browser agent
TesterAgent = Agent(
task="""
1. Go to google.com and search "cat".
""",
llm=model,
browser_context=context,
)
history = await TesterAgent.run()
tokens_used = history.total_input_tokens()
print(f"Total tokens used: {tokens_used}")
asyncio.run(main())
Version
git main branch
LLM Model
Other (specify in description)
Operating System
macos 15.3.1 (24D70)
Relevant Log Output