From bdf0a1412bec5f8aaf8db7622b7a05ffe8d922e1 Mon Sep 17 00:00:00 2001 From: foxhui Date: Thu, 11 Dec 2025 02:01:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8B=9F=E4=BA=BA?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=9C=A8=E8=8B=B9=E6=9E=9C=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=B8=8A=E6=97=A0=E6=B3=95=E5=85=A8=E9=80=89=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/browser/utils.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/browser/utils.js b/lib/browser/utils.js index aa7e9f6..3734796 100644 --- a/lib/browser/utils.js +++ b/lib/browser/utils.js @@ -242,10 +242,11 @@ export async function humanType(page, target, text) { // 2. 停顿思考 await sleep(500, 1000); - // 3. 全选删除 - await page.keyboard.down('Control'); + // 3. 全选删除 (macOS 使用 Meta/Command, Windows/Linux 使用 Control) + const modifierKey = process.platform === 'darwin' ? 'Meta' : 'Control'; + await page.keyboard.down(modifierKey); await page.keyboard.press('A'); - await page.keyboard.up('Control'); + await page.keyboard.up(modifierKey); await sleep(100, 300); await page.keyboard.press('Backspace'); await sleep(100, 300);