Download deploy/scripts/shot_wm2.js from eduzrh/helloworld: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/deploy/scripts/shot_wm2.js
- Command line
-
hf download hf://datasets/eduzrh/helloworld/deploy/scripts/shot_wm2.js
-
curl -L -o shot_wm2.js https://huggingface.co/datasets/eduzrh/helloworld/resolve/main/deploy/scripts/shot_wm2.js
1.03 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}, locale:'zh-CN' }); | |
| const page = await ctx.newPage(); | |
| await page.goto('http://127.0.0.1/wm/', {waitUntil:'domcontentloaded',timeout:60000}); | |
| await page.waitForTimeout(20000); | |
| // 关掉 workspace 弹窗 | |
| for (const s of ['button:has-text("RESET")','button[aria-label="Close"]']) { | |
| try { const e=page.locator(s).first(); if(await e.count() && await e.isVisible()){ await e.click({timeout:3000}); await page.waitForTimeout(1500);} } catch(e){} | |
| } | |
| await page.keyboard.press('Escape').catch(()=>{}); | |
| await page.waitForTimeout(30000); | |
| await page.screenshot({path:'/data/shots/wm_map.png'}); | |
| console.log('shot done'); | |
| await b.close(); | |
| })(); | |