44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import { createDriver } from '../drivers/factory';
|
|
import { sleep } from '../utils/common';
|
|
import * as dotenv from 'dotenv';
|
|
import * as path from 'path';
|
|
|
|
dotenv.config({ path: path.resolve(__dirname, '../.env') });
|
|
|
|
async function debug() {
|
|
const driver = createDriver();
|
|
await driver.createSession();
|
|
console.log('Session created, platform:', driver.platform);
|
|
|
|
await sleep(2000);
|
|
const source = await driver.getSource();
|
|
console.log('Source length:', source.length);
|
|
console.log('Has "AI Hub 6C":', source.includes('AI Hub 6C'));
|
|
console.log('Has "Home":', source.includes('Home'));
|
|
console.log('Has "Add":', source.includes('Add'));
|
|
|
|
// Try findDeviceCard
|
|
const hubEl = await (driver as any).findDeviceCard('AI Hub 6C');
|
|
console.log('findDeviceCard result:', hubEl);
|
|
|
|
if (hubEl) {
|
|
const rect = await driver.getElementRect(hubEl);
|
|
console.log('Element rect:', rect);
|
|
// Try tapping it
|
|
await driver.tap(rect.x + 100, rect.y + 30);
|
|
await sleep(5000);
|
|
const s2 = await driver.getSource();
|
|
console.log('After tap - Has "Try OpenClaw":', s2.includes('Try OpenClaw'));
|
|
console.log('After tap - Has "Cameras":', s2.includes('Cameras'));
|
|
console.log('After tap - Has "AI Events":', s2.includes('AI Events'));
|
|
} else {
|
|
// Check what's visible
|
|
console.log('--- First 2000 chars of source ---');
|
|
console.log(source.substring(0, 2000));
|
|
}
|
|
|
|
await driver.destroySession();
|
|
}
|
|
|
|
debug().catch(e => { console.error('ERROR:', e.message); process.exit(1); });
|