Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser-agent not working - Playwright error #312

Open
arsaboo opened this issue Feb 8, 2025 · 3 comments
Open

Browser-agent not working - Playwright error #312

arsaboo opened this issue Feb 8, 2025 · 3 comments

Comments

@arsaboo
Copy link

arsaboo commented Feb 8, 2025

Tried using browser-agent and I am getting this error:

Agent 0: Generating
{
    "thoughts": [
        "I need to scrape the top 5 news items from Hacker News.",
        "I will use a browser agent to navigate and extract the information."
    ],
    "tool_name": "browser_agent",
    "tool_args": {
        "message": "Open https://news.ycombinator.com/ and extract the titles and links of the top 5 news items. End task.",
        "reset": "true"
    }
}
Agent 0: Using tool 'browser_agent'
Message: Open https://news.ycombinator.com/ and extract the titles and links of the top 5 news items. End task.
Reset: true
ERROR    [browser] Failed to initialize Playwright browser: BrowserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium_headless_shell-1148/chrome-linux/headless_shell
╔════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated.       ║
║ Please run the following command to download new browsers: ║
║                                                            ║
║     playwright install                                     ║
║                                                            ║
║ <3 Playwright Team                                         ║
╚════════════════════════════════════════════════════════════╝
Traceback (most recent call last):
Traceback (most recent call last):
  File "/a0/agent.py", line 310, in monologue
    tools_result = await self.process_tools(agent_response)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/a0/agent.py", line 637, in process_tools
    response = await tool.execute(**tool_args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/a0/python/tools/browser_agent.py", line 183, in execute
    result = await task.result()
             ^^^^^^^^^^^^^^^^^^^
  File "/a0/python/helpers/defer.py", line 114, in result
    return await loop.run_in_executor(None, _get_result)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/a0/python/helpers/defer.py", line 106, in _get_result
    result = self._future.result(timeout)  # type: ignore
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/a0/python/helpers/defer.py", line 83, in _run
    return await self.func(*self.args, **self.kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>  9 stack lines skipped <<<
  File "/opt/venv/lib/python3.11/site-packages/browser_use/browser/browser.py", line 89, in _init
    browser = await self._setup_browser(playwright)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/browser_use/browser/browser.py", line 152, in _setup_browser
    browser = await playwright.chromium.launch(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/playwright/async_api/_generated.py", line 14404, in launch
    await self._impl_obj.launch(
  File "/opt/venv/lib/python3.11/site-packages/playwright/_impl/_browser_type.py", line 95, in launch
    Browser, from_channel(await self._channel.send("launch", params))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 61, in send
    return await self._connection.wrap_api_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/playwright/_impl/_connection.py", line 528, in wrap_api_call
    raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.Error: BrowserType.launch: Executable doesn't exist at /root/.cache/ms-playwright/chromium_headless_shell-1148/chrome-linux/headless_shell
╔════════════════════════════════════════════════════════════╗
║ Looks like Playwright was just installed or updated.       ║
║ Please run the following command to download new browsers: ║
║                                                            ║
║     playwright install                                     ║
║                                                            ║
║ <3 Playwright Team                                         ║
╚════════════════════════════════════════════════════════════╝

I am running agent-zero using docker with Ollama.

@Jukeman9
Copy link

Jukeman9 commented Feb 8, 2025

after you ask the agent to install playwright, then it still does not work as instead of opening the urls new card 'about:blank' is being opened and it throws out an error @frdel

@arsaboo
Copy link
Author

arsaboo commented Feb 8, 2025

@Jukeman9 you gave me the idea and I asked the agent to install playwright and the dependencies and now browser-agent is working. However, it is not giving the output:

Image

Text	
'NoneType' object has no attribute 'strip'


Traceback (most recent call last):
Traceback (most recent call last):
  File "/[a0](http://192.168.2.162:50001/#)/[agent.py](http://192.168.2.162:50001/#)", line 310, in monologue
    tools_result = await self.process_tools(agent_response)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/[a0](http://192.168.2.162:50001/#)/[agent.py](http://192.168.2.162:50001/#)", line 639, in process_tools
    await tool.after_execution(response)
  File "/[a0](http://192.168.2.162:50001/#)/[python](http://192.168.2.162:50001/#)/[helpers](http://192.168.2.162:50001/#)/[tool.py](http://192.168.2.162:50001/#)", line 34, in after_execution
    text = response.message.strip()
           ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'strip'


AttributeError: 'NoneType' object has no attribute 'strip'

@romano
Copy link

romano commented Feb 8, 2025

For some reason the script expects chromium_headless_shell-1148 but chromium_headless_shell-1155 is available instead. Instead of telling the AI to install playwright I did it myself manually (/a0/docker/run/fs/ins/install_playwright.sh or /ins/install_playwright.sh, can't remember) and it replaced the files with expected ones. Anyway, the same result as you, sorta works but not really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants