Download deploy/scripts/shot4.js from eduzrh/helloworld: direct link, hf CLI and curl.
- Browser
- Download file 1.67 kB
-
https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/deploy/scripts/shot4.js
- Command line
-
hf download hf://datasets/eduzrh/helloworld/deploy/scripts/shot4.js
-
curl -L -o shot4.js https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/deploy/scripts/shot4.js
1.67 kB
| 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: 1600, height: 1000 } }); | |
| const page = await ctx.newPage(); | |
| await page.goto('http://127.0.0.1/', { waitUntil: 'domcontentloaded', timeout: 60000 }); | |
| await page.waitForTimeout(12000); | |
| for (let round = 0; round < 25; round++) { | |
| const clicked = await page.evaluate(() => { | |
| const norm = s => (s || '').trim().toUpperCase(); | |
| const btns = [...document.querySelectorAll('button, [role="button"]')] | |
| .filter(e => e.offsetParent !== null); | |
| const wanted = ['LAUNCH', 'CONTINUE', 'NEXT', 'SKIP', 'ENTER', 'GOT IT', 'DONE', 'CLOSE', 'ACCEPT']; | |
| for (const w of wanted) { | |
| const hit = btns.find(x => norm(x.innerText) === w); | |
| if (hit) { hit.click(); return 'text:' + w; } | |
| } | |
| const aria = document.querySelector('button[aria-label="Close"], button[aria-label="close"]'); | |
| if (aria && aria.offsetParent !== null) { aria.click(); return 'aria:close'; } | |
| return null; | |
| }); | |
| if (!clicked) break; | |
| console.log('click', clicked); | |
| await page.waitForTimeout(3500); | |
| } | |
| await page.waitForTimeout(35000); | |
| await page.screenshot({ path: '/data/shots/shadowbroker_dash.png' }); | |
| const t = (await page.evaluate(() => document.body.innerText)).replace(/\s+/g, ' '); | |
| console.log('LEN', t.length, '|', t.slice(0, 300)); | |
| await b.close(); | |
| })(); | |