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[]; (async()=>{const d=createDriver();await d.createSession();try{ await d.dismissPopupIfPresent();await d.goBackToHomepage();await sleep(1000); let el=null;for(let i=0;i<8;i++){el=await d.findElementRaw('-android uiautomator','new UiSelector().textContains("Keypad Vision")').catch(()=>null);if(el)break;await d.swipe(540,1500,540,700,0.4).catch(()=>{});await sleep(700);} if(!el){console.log('找不到Keypad卡片');return;} const r=await d.getElementRect(el);await d.tap(r.x+100,r.y-20);await sleep(5000);await d.dismissPopupIfPresent();await sleep(1500); console.log('功能页: '+JSON.stringify(await dump(d))); }catch(e:any){console.error('FAIL:',e.message);}finally{await d.destroySession();}})();