fix: 修复拟人输入在苹果系统上无法全选删除的问题

This commit is contained in:
foxhui
2025-12-11 02:01:10 +08:00
Unverified
parent 801eb74b24
commit bdf0a1412b
+4 -3
View File
@@ -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);