Files
web-Iot/scripts/probe_login.mjs

16 lines
806 B
JavaScript

import { chromium } from 'playwright';
const browser = await chromium.launch({ channel: 'msedge', headless: true });
const page = await browser.newPage({ viewport: { width: 1680, height: 1050 } });
await page.goto('http://127.0.0.1:3001/login', { waitUntil: 'domcontentloaded' });
await page.waitForTimeout(3000);
const info = await page.evaluate(() => {
const inputs = [...document.querySelectorAll('input')].map(i => ({
type: i.type, id: i.id, name: i.name, ph: i.placeholder, cls: i.className.slice(0, 60)
}));
const btns = [...document.querySelectorAll('button')].map(b => ({ text: b.innerText.trim().slice(0, 20), cls: b.className.slice(0, 60) }));
return { inputs, btns, title: document.title, url: location.href };
});
console.log(JSON.stringify(info, null, 2));
await browser.close();