Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
fix(cli): support module invocation on Windows
UniversePeakf363b81b6609
diff --git a/browser_use/__main__.py b/browser_use/__main__.pynew file mode 100644index 000000000..dd169233c--- /dev/null+++ b/browser_use/__main__.py@@ -0,0 +1,10 @@+"""Run the Browser Use CLI with ``python -m browser_use``."""++import sys++from browser_use.cli import main++if __name__ == '__main__':+ result = main()+ if result is not None:+ sys.exit(result)diff --git a/tests/ci/test_browser_use_cli.py b/tests/ci/test_browser_use_cli.pyindex dac622757..b0177e0f1 100644--- a/tests/ci/test_browser_use_cli.py+++ b/tests/ci/test_browser_use_cli.py@@ -6,11 +6,11 @@ from pathlib import PathROOT = Path(__file__).resolve().parents[2]-def _run_browser_use_cli(*args: str) -> subprocess.CompletedProcess[str]:+def _run_browser_use_cli(*args: str, module: str = 'browser_use.cli') -> subprocess.CompletedProcess[str]:env = os.environ.copy()env['PYTHONPATH'] = os.pathsep.join(part for part in (str(ROOT), env.get('PYTHONPATH', '')) if part)return subprocess.run(- [sys.executable, '-m', 'browser_use.cli', *args],+ [sys.executable, '-m', module, *args],cwd=ROOT,env=env,capture_output=True,@@ -27,6 +27,14 @@ def test_browser_use_doctor_help_prints_browser_use_usage():assert result.stderr == ''+def test_browser_use_module_entrypoint_matches_cli_entrypoint():+ result = _run_browser_use_cli('doctor', '--help', module='browser_use')++ assert result.returncode == 0+ assert result.stdout == 'usage: browser-use doctor [--fix-snap]\n'+ assert result.stderr == ''++def test_normalize_captured_cli_output_handles_string_system_exit(capsys):from browser_use.cli import _normalize_captured_cli_output