diff --git a/AGENTS.MD b/AGENTS.MD index 6b70ac5a7..9ec04ba1d 100644 --- a/AGENTS.MD +++ b/AGENTS.MD @@ -50,8 +50,7 @@ source .venv/bin/activate ``` ```bash install browser-use & chromium uv pip install browser-use -uvx playwright install chromium --with-deps -# Note: this does NOT install playwright, only chromium +browser-use install ``` @@ -63,12 +62,40 @@ source .venv/bin/activate ``` ```bash install browser-use & chromium pip install browser-use -pip install playwright && playwright install chromium --with-deps +browser-use install ``` -On Windows, use `.venv\Scripts\activate` to activate the environment. + + + ```bash activate environment theme={null} + source .venv/bin/activate + ``` + + + + ```bash activate environment theme={null} + .venv\Scripts\activate + ``` + + + + + + ```bash install browser-use & chromium theme={null} + uv pip install browser-use + browser-use install + ``` + + + + ```bash install browser-use & chromium theme={null} + pip install browser-use + browser-use install + ``` + + ## 2. Choose your favorite LLM Create a `.env` file and add your API key. @@ -196,8 +223,7 @@ source .venv/bin/activate ``` ```bash install browser-use & chromium uv pip install browser-use -uvx playwright install chromium --with-deps -# Note: this does NOT install playwright, only chromium +browser-use install ``` @@ -209,7 +235,7 @@ source .venv/bin/activate ``` ```bash install browser-use & chromium pip install browser-use -pip install playwright && playwright install chromium --with-deps +browser-use install ``` diff --git a/README.md b/README.md index 941ec10c6..4b5f2dd63 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,9 @@ uv sync BROWSER_USE_API_KEY=your-key ``` -**4. Download chromium using playwright's shortcut:** +**4. Install Chromium browser:** ```bash -uvx playwright install chromium --with-deps --no-shell +browser-use install ``` **5. Run your first agent:** diff --git a/browser_use/browser/watchdogs/local_browser_watchdog.py b/browser_use/browser/watchdogs/local_browser_watchdog.py index a5460345c..19306e9f4 100644 --- a/browser_use/browser/watchdogs/local_browser_watchdog.py +++ b/browser_use/browser/watchdogs/local_browser_watchdog.py @@ -314,14 +314,16 @@ class LocalBrowserWatchdog(BaseWatchdog): async def _install_browser_with_playwright(self) -> str: """Get browser executable path from playwright in a subprocess to avoid thread issues.""" + import platform + + # Build command - only use --with-deps on Linux (it fails on Windows/macOS) + cmd = ['uvx', 'playwright', 'install', 'chrome'] + if platform.system() == 'Linux': + cmd.append('--with-deps') # Run in subprocess with timeout process = await asyncio.create_subprocess_exec( - 'uvx', - 'playwright', - 'install', - 'chrome', - '--with-deps', + *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, ) @@ -333,7 +335,7 @@ class LocalBrowserWatchdog(BaseWatchdog): if browser_path: return browser_path self.logger.error(f'[LocalBrowserWatchdog] āŒ Playwright local browser installation error: \n{stdout}\n{stderr}') - raise RuntimeError('No local browser path found after: uvx playwright install chrome --with-deps') + raise RuntimeError('No local browser path found after: uvx playwright install chrome') except TimeoutError: # Kill the subprocess if it times out process.kill() diff --git a/browser_use/cli.py b/browser_use/cli.py index 0cac1f1d6..279731bd6 100644 --- a/browser_use/cli.py +++ b/browser_use/cli.py @@ -11,6 +11,30 @@ if '--mcp' in sys.argv: os.environ['BROWSER_USE_SETUP_LOGGING'] = 'false' logging.disable(logging.CRITICAL) +# Special case: install command doesn't need CLI dependencies +if len(sys.argv) > 1 and sys.argv[1] == 'install': + import platform + import subprocess + + print('šŸ“¦ Installing Chromium browser + system dependencies...') + print('ā³ This may take a few minutes...\n') + + # Build command - only use --with-deps on Linux (it fails on Windows/macOS) + cmd = ['uvx', 'playwright', 'install', 'chromium'] + if platform.system() == 'Linux': + cmd.append('--with-deps') + cmd.append('--no-shell') + + result = subprocess.run(cmd) + + if result.returncode == 0: + print('\nāœ… Installation complete!') + print('šŸš€ Ready to use! Run: uvx browser-use') + else: + print('\nāŒ Installation failed') + sys.exit(1) + sys.exit(0) + import asyncio import json import logging @@ -2004,5 +2028,30 @@ def auth(): asyncio.run(run_auth_command()) +@main.command() +def install(): + """Install Chromium browser with system dependencies""" + import platform + import subprocess + + print('šŸ“¦ Installing Chromium browser + system dependencies...') + print('ā³ This may take a few minutes...\n') + + # Build command - only use --with-deps on Linux (it fails on Windows/macOS) + cmd = ['uvx', 'playwright', 'install', 'chromium'] + if platform.system() == 'Linux': + cmd.append('--with-deps') + cmd.append('--no-shell') + + result = subprocess.run(cmd) + + if result.returncode == 0: + print('\nāœ… Installation complete!') + print('šŸš€ Ready to use! Run: uvx browser-use') + else: + print('\nāŒ Installation failed') + sys.exit(1) + + if __name__ == '__main__': main() diff --git a/docs/examples/apps/vibetest-use.mdx b/docs/examples/apps/vibetest-use.mdx index 0235b86b2..f826227b1 100644 --- a/docs/examples/apps/vibetest-use.mdx +++ b/docs/examples/apps/vibetest-use.mdx @@ -38,7 +38,7 @@ source .venv/bin/activate uv pip install -e . # 4. Install browser runtime once -playwright install chromium --with-deps --no-shell +browser-use install ``` ### 1) Claude Code diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 2103d4e4f..48731820f 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -22,8 +22,7 @@ source .venv/bin/activate ``` ```bash install browser-use & chromium uv pip install browser-use -uvx playwright install chromium --with-deps -# Note: this does NOT install playwright, only chromium +browser-use install ``` @@ -35,7 +34,7 @@ source .venv/bin/activate ``` ```bash install browser-use & chromium pip install browser-use -pip install playwright && playwright install chromium --with-deps +browser-use install ``` diff --git a/examples/getting_started/01_basic_search.py b/examples/getting_started/01_basic_search.py index c82451093..dcdce631a 100644 --- a/examples/getting_started/01_basic_search.py +++ b/examples/getting_started/01_basic_search.py @@ -20,7 +20,7 @@ from browser_use import Agent, ChatBrowserUse async def main(): llm = ChatBrowserUse() - task = "We are testing the send_keys function. Go to https://inputtypes.com/ and focus the input box and type 'hello world'. DO NOT use the input_text action. Only use the send_keys action. Mark the task as done right after using the send_keys action." + task = "Search Google for 'what is browser automation' and tell me the top 3 results" agent = Agent(task=task, llm=llm) await agent.run() diff --git a/pyproject.toml b/pyproject.toml index e3c6d6a1e..b5d015931 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "browser-use" description = "Make websites accessible for AI agents" authors = [{ name = "Gregor Zunic" }] -version = "0.9.1" +version = "0.9.2" readme = "README.md" requires-python = ">=3.11,<4.0" classifiers = [