Files
yidaima_tools/core/browser.py
王鹏 a2f5875d1b init
2026-04-09 14:55:54 +08:00

29 lines
691 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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