File size: 1,465 Bytes
f9de565
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const { chromium } = require('playwright-core');
(async () => {
  const browser = 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 browser.newContext({ viewport: { width: 1600, height: 1000 } });
  const page = await ctx.newPage();
  await page.goto('http://127.0.0.1/', { waitUntil: 'domcontentloaded', timeout: 60000 });
  await page.waitForTimeout(15000);
  const sels = ['button:has-text("CONTINUE")', 'button:has-text("NEXT")',
                'button:has-text("SKIP")', 'button:has-text("GET STARTED")',
                'button:has-text("ENTER")', 'button:has-text("LAUNCH")', 'button[aria-label="Close"]'];
  for (let i = 0; i < 8; i++) {
    let clicked = false;
    for (const s of sels) {
      try {
        const el = page.locator(s).first();
        if (await el.count() && await el.isVisible()) {
          await el.click({ timeout: 4000 }); clicked = true;
          await page.waitForTimeout(4000); break;
        }
      } catch (e) {}
    }
    if (!clicked) break;
  }
  await page.waitForTimeout(45000);
  await page.screenshot({ path: '/data/shots/shadowbroker_ready.png' });
  const t = (await page.evaluate(() => document.body.innerText)).replace(/\s+/g, ' ');
  console.log('TEXT:', t.slice(0, 500));
  await browser.close();
})();