← back to Eur Recrawl
inspect-dg.mjs
27 lines
// inspect-dg.mjs — reuse the CF-cleared .auth/dg session to dump the login form's
// real structure (inputs/buttons across all frames) so login.mjs can target it.
import { chromium } from 'playwright';
import path from 'node:path';
const ctx = await chromium.launchPersistentContext(path.join(process.cwd(), '.auth', 'dg'), {
headless: false, channel: 'chrome', viewport: { width: 1440, height: 900 },
});
const page = ctx.pages()[0] || await ctx.newPage();
await page.goto('https://www.designersguild.com/en-us/login/l102?t=1', { waitUntil: 'domcontentloaded', timeout: 60000 }).catch((e) => console.log('nav', e.message));
await page.waitForTimeout(7000);
console.log('title:', await page.title().catch(() => ''), '| url:', page.url());
console.log('frames:', page.frames().length);
for (const fr of page.frames()) {
const els = await fr.evaluate(() =>
[...document.querySelectorAll('input, button, [role=button]')].map((el) => ({
tag: el.tagName, type: el.type || '', name: el.name || '', id: el.id || '',
ph: el.placeholder || '', ac: el.autocomplete || '', txt: (el.innerText || el.value || '').slice(0, 25),
})),
).catch(() => []);
if (els.length) console.log(`\n[frame ${fr.url().slice(0, 70)}]\n` + JSON.stringify(els));
}
await page.screenshot({ path: 'probe-dg-login.png', fullPage: false }).catch(() => {});
console.log('\nscreenshot -> probe-dg-login.png');
await page.waitForTimeout(2000);
await ctx.close();