17 lines
860 B
TypeScript
17 lines
860 B
TypeScript
import { createDriver } from '../drivers/factory';
|
|
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
|
(async () => {
|
|
const d = createDriver();
|
|
await d.createSession();
|
|
try {
|
|
// 点 "Skip this guide" 跳过接线引导
|
|
const skip = await d.findElementRaw('-android uiautomator', 'new UiSelector().textContains("Skip this guide")').catch(() => null);
|
|
if (skip) { await d.tapElement(skip); console.log('已点 Skip this guide'); await sleep(2500); }
|
|
else console.log('未找到 Skip this guide');
|
|
const src = await d.getSource();
|
|
const texts = [...new Set(Array.from(src.matchAll(/text="([^"]+)"/g)).map((m) => m[1]).filter((t) => t.trim()))];
|
|
console.log('跳过后页面文案=' + JSON.stringify(texts));
|
|
} catch (e: any) { console.error('FAIL:', e.message); }
|
|
finally { await d.destroySession(); }
|
|
})();
|