← back to Delivery Address Fix

scripts/state.js

14 lines

// Diagnose the current gate: screenshot + page text + visible inputs.
// Usage: node state.js --port 9223 --match uber.com [--platform ubereats]
const { parseArgs, loadConfig, platform, sessionDir, findTab, dumpState } = require('./lib');

(async () => {
  const args = parseArgs(process.argv);
  const cfg = loadConfig();
  const match = args.match || (args.platform && platform(args.platform).match);
  if (!match) { console.error('Need --match <url-substring> or --platform'); process.exit(2); }
  const { browser, page } = await findTab(args.port || cfg.cdp_port || 9223, match);
  await dumpState(page, sessionDir(cfg, args), 'state');
  await browser.close();
})().catch(e => { console.error('ERR', e.message); process.exit(1); });