29 lines
691 B
Python
29 lines
691 B
Python
|
|
from __future__ import annotations
|
|||
|
|
|
|||
|
|
"""
|
|||
|
|
本项目的核心是“桌面 OCR + 点击”。若后续需要操作 Web 端(如 DMS/ERP),可以在此处接入 Playwright。
|
|||
|
|
当前先提供一个最小骨架,避免影响主流程。
|
|||
|
|
"""
|
|||
|
|
|
|||
|
|
from dataclasses import dataclass
|
|||
|
|
from typing import Optional
|
|||
|
|
|
|||
|
|
|
|||
|
|
@dataclass(frozen=True)
|
|||
|
|
class BrowserConfig:
|
|||
|
|
headless: bool = False
|
|||
|
|
slow_mo_ms: int = 0
|
|||
|
|
user_data_dir: Optional[str] = None
|
|||
|
|
|
|||
|
|
|
|||
|
|
class Browser:
|
|||
|
|
def __init__(self, config: BrowserConfig = BrowserConfig()) -> None:
|
|||
|
|
self.config = config
|
|||
|
|
|
|||
|
|
def __enter__(self) -> "Browser":
|
|||
|
|
return self
|
|||
|
|
|
|||
|
|
def __exit__(self, exc_type, exc, tb) -> None:
|
|||
|
|
return None
|
|||
|
|
|