← Back
import { chromium } from 'playwright';
const b = await chromium.launch({ executablePath:'/usr/bin/chromium-browser', args:['--no-sandbox'] });
const ctx = await b.newContext({ viewport:{ width:390, height:1000 }, 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/', { waitUntil:'domcontentloaded', timeout:35000 });
await p.waitForTimeout(5500);
await p.click('.pk-ltoggle .pk-f', { timeout:6000 }).catch(()=>{});
await p.waitForTimeout(1000);
const found = await p.evaluate(()=>document.querySelector('.pk-found')?.innerText);
const read = ()=>p.evaluate(()=>[...document.querySelectorAll('.pk-card')].slice(0,4).map(c=>{
  const wr=c.querySelector('.pk-wrv')?.innerText, pnl=c.querySelector('.pk-cstat b')?.innerText, act=[...c.querySelectorAll('.pk-conline')][0]?.innerText;
  return `WR ${wr} P&L ${pnl} (${act})`;}));
console.log('FOUND:', found);
console.log('default(edge):'); console.log((await read()).join('\n'));
// click Activity tab
for (const t of await p.$$('.pk-sort')){ if(/activ/i.test(await t.innerText())){ await t.click(); break; } }
await p.waitForTimeout(900);
console.log('after Activity (most active losers up):'); console.log((await read()).join('\n'));
await p.screenshot({ path:'_v4.png' });
await b.close();