mirror of
https://git.oceanpay.cc/danial/kami_apple_exchage.git
synced 2025-12-18 22:29:09 +00:00
fix(playwright): 确保浏览器 headless 模式参数为布尔类型
- 在启动浏览器时,检查 headless 参数的类型 - 如果 headless 参数为字符串类型,将其转换为布尔类型 - 支持 "true", "1", "yes", "on"
This commit is contained in:
@@ -152,6 +152,14 @@ class DistributedPlaywrightManager:
|
||||
launch_options = cls._get_k8s_optimized_launch_options()
|
||||
launch_options.update(kwargs) # 允许外部覆盖参数
|
||||
|
||||
# 确保headless参数是布尔类型
|
||||
if "headless" in launch_options:
|
||||
headless_value = launch_options["headless"]
|
||||
if isinstance(headless_value, str):
|
||||
launch_options["headless"] = headless_value.lower() in ("true", "1", "yes", "on")
|
||||
elif not isinstance(headless_value, bool):
|
||||
launch_options["headless"] = bool(headless_value)
|
||||
|
||||
logger.info("启动参数", launch_options=launch_options)
|
||||
|
||||
# 启动Chromium浏览器
|
||||
|
||||
Reference in New Issue
Block a user