// browser2modellarten.4 (#1108): GPU-Nummer steht im Symbol, kein Text daneben; Bilder in (Aufruf: node gpu-symbol.mjs ); Testinstanz mit Modellen auf GPU 0,1 / 1 / 12. import * as cdp from './lib.mjs'; import fs from 'node:fs'; const BASE=process.env.NEXUS_BASE||'http://127.0.0.1:18120', pw=process.argv[2]; const b=await cdp.start({port:9351}); try{ await b.login(BASE,'claude',pw); await b.viewport(1100,500,{mobile:false}); for(const theme of ['light','dark']){ await b.goto(BASE+'/ui/modelle'); await b.eval(`document.documentElement.setAttribute('data-theme','${theme}');localStorage.setItem('theme','${theme}')`); await new Promise(r=>setTimeout(r,600)); const info=await b.eval(`[...document.querySelectorAll('tr')].filter(r=>/gpu|zwei|eine/.test(r.innerText)).map(r=>{const c=[...r.querySelectorAll('.fkann')];return {zeile:r.innerText.split('\\n')[0].slice(0,24),symbole:c.map(x=>({text:x.innerText.trim(),svgText:x.querySelector('svg text')?.textContent,aria:x.querySelector('svg')?.getAttribute('aria-label'),w:Math.round(x.querySelector('svg').getBoundingClientRect().width)}))}}).filter(x=>x.symbole.length)`); console.log(theme, JSON.stringify(info)); await b.send('Emulation.setDeviceMetricsOverride',{width:1100,height:500,deviceScaleFactor:3,mobile:false});const r=await b.eval(`(()=>{const t=document.querySelector('th:nth-child(5)').getBoundingClientRect();return [t.x-10,t.y-5]})()`);const c=await b.send('Page.captureScreenshot',{format:'png',clip:{x:r[0],y:r[1],width:230,height:190,scale:1}});fs.writeFileSync(`${process.argv[3]}/gpu-${theme}.png`,Buffer.from(c.data,'base64')); } }finally{b.close();}