/** * 会议模式:从聊天页正确导航进去 → 运行 → 截图。 * 用法: node scripts/device-meeting-run2.mjs */ import { spawnSync } from 'node:child_process'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; const SERIAL = process.argv[2] || 'emulator-5556'; const ADB = process.env.ADB || 'C:\\Android\\Sdk\\platform-tools\\adb.exe'; const OUT = path.join(os.tmpdir(), 'meeting-shots'); fs.mkdirSync(OUT, { recursive: true }); const sh = (...a) => spawnSync(ADB, ['-s', SERIAL, ...a], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 }); const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); async function shot(n) { sh('shell', 'screencap', '-p', '/sdcard/_s.png'); sh('pull', '/sdcard/_s.png', path.join(OUT, `${n}.png`)); console.log(' 截图', n); } async function tap(x, y, w = 1400) { sh('shell', 'input', 'tap', String(x), String(y)); await sleep(w); } console.log('① 开抽屉 → 会议模式'); await tap(45, 105); await tap(250, 561, 2500); await shot('20-list'); console.log('② 点第一个会议'); // 列表第一项大约在 y=300 附近(标题说明文字下方) await tap(300, 300, 3000); await shot('21-editor'); console.log('③ 运行(输入框留空,用节点里的文本)'); await tap(617, 1205, 1500); for (let i = 1; i <= 8; i += 1) { await sleep(4000); await shot(`22-run-${i}`); } console.log('完成,截图在', OUT);