From d25220787d0fabd0b3e046fd238e42cf6e9ca817 Mon Sep 17 00:00:00 2001 From: rqi14 Date: Mon, 11 May 2026 11:50:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(login):=20=E8=A7=A3=E9=99=A4=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=B5=8F=E8=A7=88=E5=99=A8=20viewport=20=E9=94=81?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Puppeteer 默认 defaultViewport 为 800×600,导致登录页内容区被锁死在 该尺寸,与浏览器窗口不匹配,出现比例异常。 设置 defaultViewport: null 让浏览器自然控制 viewport,并加 --window-size=1440,900 给出合理的初始窗口大小。 Co-Authored-By: Claude Sonnet 4.6 --- .../index.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/launch-bosszhipin-login-page-with-preload-extension/index.mjs b/packages/launch-bosszhipin-login-page-with-preload-extension/index.mjs index cf6b30b..1b11206 100644 --- a/packages/launch-bosszhipin-login-page-with-preload-extension/index.mjs +++ b/packages/launch-bosszhipin-login-page-with-preload-extension/index.mjs @@ -31,7 +31,9 @@ export async function main() { const browser = await puppeteer.launch({ headless: false, pipe: true, - enableExtensions: [editThisCookieExtensionPath] + enableExtensions: [editThisCookieExtensionPath], + defaultViewport: null, + args: ['--window-size=1440,900'] }) const closeAttachedSet = new WeakSet()