import { createDriver } from '../drivers/factory'; const sleep=(ms:number)=>new Promise(r=>setTimeout(r,ms)); const dump=async(d:any):Promise=>[...new Set((Array.from((await d.getSource()).matchAll(/text="([^"]+)"/g)) as any[]).map(m=>m[1]).filter((t:string)=>t.trim()&&t.length<30))] as string[]; const clkOf=async(d:any):Promise=>Array.from((await d.getSource()).matchAll(/clickable="true"[^>]*?bounds="(\[\d+,\d+\]\[\d+,\d+\])"/g)).map((m:any)=>m[1]); (async()=>{const d=createDriver();await d.createSession();try{ console.log('当前页: '+JSON.stringify(await dump(d))); // 点 Passcode 图标(左列 ~195,909) await d.tap(195,909);await sleep(2500); console.log('点Passcode图标后: '+JSON.stringify(await dump(d))); console.log('该页clickable: '+JSON.stringify((await clkOf(d)).slice(0,15))); }catch(e:any){console.error('FAIL:',e.message);}finally{await d.destroySession();}})();