Playwright headless 设置

在 Suan API 设置中添加控制 playwright headless 模式的设置。
This commit is contained in:
2026-04-21 17:53:20 +08:00
parent 16bd8e9f9a
commit 06d4b605b1
4 changed files with 11 additions and 1 deletions

View File

@@ -6,6 +6,8 @@ from playwright.async_api import (
async_playwright,
)
from . import config
class PlayContextManager:
def __init__(
@@ -26,7 +28,7 @@ class PlayContextManager:
"""手动启动"""
self.playwright = await async_playwright().start() # 不是 __enter__
self.browser = await self.playwright.chromium.launch(
headless=False,
headless=config.get("schedule", "playwright_headless", True),
args=[
"--disable-blink-features=AutomationControlled",
"--no-sandbox",