← Back
import { chromium } from 'playwright';
const b = await chromium.launch({ executablePath:'/usr/bin/chromium-browser', args:['--no-sandbox'] });
async function go(path,sel,file){
  const ctx = await b.newContext({ viewport:{ width:390, height:1300 }, deviceScaleFactor:1.5, serviceWorkers:'block' });
  await ctx.addInitScript(()=>{localStorage.setItem('sz_theme','dark');localStorage.setItem('sz_accent','green');});
  const p = await ctx.newPage();
  await p.goto('https://poly-dev.szhub.space'+path, { waitUntil:'domcontentloaded', timeout:35000 });
  await p.waitForTimeout(5000);
  const has = await p.evaluate(s=>!!document.querySelector(s), sel);
  await p.screenshot({ path:file });
  console.log(path, has);
  await ctx.close();
}
await go('/more','.pk-more','_more.png');
await go('/settings','.pk-settings','_settings.png');
await b.close();