File size: 976 Bytes
32424cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const { chromium } = require('playwright-core');
(async () => {
  const b = await chromium.launch({
    executablePath: '/data/tools/chrome-headless-shell-linux64/chrome-headless-shell',
    args: ['--no-sandbox','--disable-dev-shm-usage','--use-gl=swiftshader','--enable-unsafe-swiftshader'],
  });
  const ctx = await b.newContext({ viewport:{width:1400,height:900}, locale:'zh-CN' });
  const page = await ctx.newPage();
  const urls = new Map();
  page.on('requestfailed', r => { const u=r.url(); if(!urls.has(u)) urls.set(u,'FAIL '+ (r.failure()||{}).errorText); });
  page.on('response', r => { const u=r.url(); if(/tile|\.png|\.pbf|carto|mapbox|arcgis|osm/.test(u) && !urls.has(u)) urls.set(u, r.status()); });
  await page.goto('http://127.0.0.1/wm/', {waitUntil:'domcontentloaded',timeout:60000});
  await page.waitForTimeout(25000);
  const rows = [...urls.entries()].slice(0,25);
  for (const [u,s] of rows) console.log(s, u.slice(0,110));
  await b.close();
})();