← back to Cronjobs Viewer

5x/capture-404.js

14 lines

const pw = require('/Users/macstudio3/.npm-global/lib/node_modules/playwright');
const CHROME = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
(async () => {
  const b = await pw.chromium.launch({ executablePath: CHROME });
  const ctx = await b.newContext({ httpCredentials:{username:'admin',password:'DW2024!'}});
  const p = await ctx.newPage();
  const bad = [];
  p.on('response', r => { if (r.status() >= 400) bad.push(`${r.status()}  ${r.url()}`); });
  await p.goto('http://127.0.0.1:9772/', { waitUntil:'networkidle', timeout:20000 });
  await p.waitForTimeout(1500);
  await b.close();
  console.log(bad.length ? bad.join('\n') : 'NO 4xx/5xx');
})();