browser-use--browser-harness
6c9ddf56fe
When BH_DEBUG_CLICKS=1 (or --debug-clicks CLI flag), click_at_xy captures a screenshot before each click and draws a red crosshair at the exact click location, scaled by window.devicePixelRatio so the marker aligns correctly on HiDPI/Retina displays. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
66 行
1.6 KiB
Python
66 行
1.6 KiB
Python
import os, sys
|
|
|
|
from admin import (
|
|
_version,
|
|
ensure_daemon,
|
|
list_cloud_profiles,
|
|
list_local_profiles,
|
|
print_update_banner,
|
|
restart_daemon,
|
|
run_doctor,
|
|
run_setup,
|
|
run_update,
|
|
start_remote_daemon,
|
|
stop_remote_daemon,
|
|
sync_local_profile,
|
|
)
|
|
from helpers import *
|
|
|
|
HELP = """Browser Harness
|
|
|
|
Read SKILL.md for the default workflow and examples.
|
|
|
|
Typical usage:
|
|
uv run bh <<'PY'
|
|
ensure_real_tab()
|
|
print(page_info())
|
|
PY
|
|
|
|
Helpers are pre-imported. The daemon auto-starts and connects to the running browser.
|
|
|
|
Commands:
|
|
browser-harness --version print the installed version
|
|
browser-harness --doctor diagnose install, daemon, and browser state
|
|
browser-harness --setup interactively attach to your running browser
|
|
browser-harness --update [-y] pull the latest version (agents: pass -y)
|
|
"""
|
|
|
|
|
|
def main():
|
|
args = sys.argv[1:]
|
|
if args and args[0] in {"-h", "--help"}:
|
|
print(HELP)
|
|
return
|
|
if args and args[0] == "--version":
|
|
print(_version() or "unknown")
|
|
return
|
|
if args and args[0] == "--doctor":
|
|
sys.exit(run_doctor())
|
|
if args and args[0] == "--setup":
|
|
sys.exit(run_setup())
|
|
if args and args[0] == "--update":
|
|
yes = any(a in {"-y", "--yes"} for a in args[1:])
|
|
sys.exit(run_update(yes=yes))
|
|
if args and args[0] == "--debug-clicks":
|
|
os.environ["BH_DEBUG_CLICKS"] = "1"
|
|
args = args[1:]
|
|
if not args or args[0] != "-c":
|
|
sys.exit("Usage: browser-harness -c \"print(page_info())\"")
|
|
print_update_banner()
|
|
ensure_daemon()
|
|
exec(args[1], globals())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|