// admin2enginefenster.3: Fenster-Symbole auf der Engines-Seite (llama.cpp gestrichelt, ohne Link; Studio mit Link), Klick auf das gestrichelte tut nichts. Aufruf: node enginefenster.mjs import * as cdp from './lib.mjs'; import fs from 'node:fs'; const BASE=process.env.NEXUS_BASE||'http://127.0.0.1:18121', pw=process.argv[2]; const b=await cdp.start({port:9364}); try{ await b.login(BASE,'claude',pw); await b.goto(BASE+'/ui/engines'); await new Promise(r=>setTimeout(r,1000)); console.log(JSON.stringify(await b.eval(`[...document.querySelectorAll('.fenster')].map(f=>{const card=f.closest('section,article,.card,tr,div[class*=karte]');const el=f.firstElementChild;const cs=getComputedStyle(el);return {engine:(card?card.innerText.slice(0,20).replace(/\\n/g,' '):'?'),tag:el.tagName,href:el.getAttribute('href'),title:el.getAttribute('title')||el.querySelector('title')?.textContent||el.getAttribute('aria-label'),border:cs.borderTopStyle,cursor:cs.cursor,klasse:el.className&&el.className.baseVal!==undefined?el.className.baseVal:el.className}})`),null,1)); const llama=await b.eval(`(()=>{const f=[...document.querySelectorAll('.fenster')][0];const r=f.getBoundingClientRect();return [r.x+r.width/2,r.y+r.height/2]})()`); await b.send('Input.dispatchMouseEvent',{type:'mouseMoved',x:llama[0],y:llama[1]}); await b.send('Input.dispatchMouseEvent',{type:'mousePressed',x:llama[0],y:llama[1],button:'left',clickCount:1}); await b.send('Input.dispatchMouseEvent',{type:'mouseReleased',x:llama[0],y:llama[1],button:'left',clickCount:1}); await new Promise(r=>setTimeout(r,800)); console.log('URL nach Klick:', await b.eval('location.pathname'), '| Seiten/Tabs:', (await (await fetch('http://127.0.0.1:9364/json')).json()).filter(t=>t.type==='page').length); await b.shot('/tmp/fenster3.png'); }finally{b.close();}