INNER CODE UNIT · Python
_approve_chrome_prompt
browser-use/macos-harness · src/macos_harness/browser.py:15
def _approve_chrome_prompt(stop: threading.Event, timeout: float) -> None:
"""Press Chrome's exact remote-debugging Allow button through system-wide AX."""
if platform.system() != "Darwin":
return
try:
import ApplicationServices as AS
except ImportError: # pragma: no cover - macOS dependency failure
return
deadline = time.monotonic() + timeout
while not stop.is_set() and time.monotonic() < deadline:
root = AS.AXUIElementCreateSystemWide()
pressed = False
windows = AS.CGWindowListCopyWindowInfo(
AS.kCGWindowListOptionOnScreenOnly, AS.kCGNullWindowID
)
for window in windows:
if window.get("kCGWindowOwnerName") != "Google Chrome":