Files
bhushanct c1eef4c6aa Initial commit: Screen Leads app
Screen-capture lead tool: capture agent, Claude vision extractor with
pluggable site recipes (LinkedIn), canonical funnel model, SQLite storage,
FastAPI backend, dashboard, and setup/run scripts.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 07:43:33 +05:30

25 lines
870 B
Python

"""Windows: reliably reading a browser's address-bar URL needs UI Automation
(pywinauto/uiautomation). We attempt a lightweight UIA read if available and
otherwise return None, letting the detector fall back to visual address-bar
reading from the screenshot.
"""
from typing import Optional
def get_active_tab_url() -> Optional[str]:
try:
import uiautomation as auto # optional dependency
except Exception:
return None
try:
window = auto.GetForegroundControl()
# Chromium/Firefox expose the address bar as an Edit control named
# "Address and search bar" / "Search or enter address".
edit = window.EditControl(searchDepth=12)
if edit.Exists(0.3):
val = (edit.GetValuePattern().Value or "").strip()
return val or None
except Exception:
return None
return None