fix(chv): _load_playwright 须返回 sync_playwright() 实例
返回函数本身则无 __enter__,真实启动路径从未跑通过(P2 假实现 掩盖;2026-11-08 构建 #8 驱动 live 抓到)。回归测试钉死该契约。
This commit is contained in:
1 parent
eb495892e1
commit
7361b0654f
2 files changed
+27
-2
No files matched your search
@@ -181,7 +181,10 @@ def truncate_a11y(node, max_nodes=MAX_A11Y_NODES,
|
||||
|
||||
|
||||
def _load_playwright():
|
||||
"""懒加载 playwright;缺失时报明错(不静默假装有浏览器)。"""
|
||||
"""懒加载 playwright;缺失时报明错(不静默假装有浏览器)。
|
||||
返回 sync_playwright() 的上下文管理器实例(须调用,
|
||||
不能只返回 sync_playwright 函数本身——函数没有 __enter__,
|
||||
2026-11-08 构建 #8 驱动 live 抓到:真实路径从未跑通过)。"""
|
||||
os.environ.setdefault("PLAYWRIGHT_BROWSERS_PATH",
|
||||
PLAYWRIGHT_BROWSERS_PATH)
|
||||
try:
|
||||
@@ -190,7 +193,7 @@ def _load_playwright():
|
||||
raise RuntimeError(
|
||||
"chv-browser: playwright 未装(%s),浏览器子代理不可用"
|
||||
% e)
|
||||
return sync_playwright
|
||||
return sync_playwright()
|
||||
|
||||
|
||||
def _fetch_cdp_version(port, timeout=5.0):
|
||||
|
||||
Reference in new issue
Block a user