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);