AI_UIAutomation/scripts/probe-pc4.ts

11 lines
694 B
TypeScript

import { createDriver } from '../drivers/factory';
const sleep=(ms:number)=>new Promise(r=>setTimeout(r,ms));
const dump=async(d:any):Promise<string[]>=>[...new Set((Array.from((await d.getSource()).matchAll(/text="([^"]+)"/g)) as any[]).map(m=>m[1]).filter((t:string)=>t.trim()&&t.length<40))] as string[];
(async()=>{const d=createDriver();await d.createSession();try{
// 确保在 Passcode tab(点左列图标)
await d.tap(195,909);await sleep(1500);
// 点底部无文案 Add (540,2211)
await d.tap(540,2211);await sleep(2500);
console.log('点底部Add后: '+JSON.stringify(await dump(d)));
}catch(e:any){console.error('FAIL:',e.message);}finally{await d.destroySession();}})();