const { chromium } = require('playwright'); const OUT = '/home/zgaetano/media-command-guide/screenshots'; const COOKIE = 's:d16cd74687c1f5e4322b9d24657efe7da055c019d97fb2e0.nHwwxY6iik6jiySDiKS6aUxacWRQy3T+dCiMTN8Fu8s'; const pause = p => p.evaluate(() => document.querySelectorAll('video').forEach(v => { try { v.pause() } catch(e){} })); (async () => { const b = await chromium.launch({ headless: true, args: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required'] }); const c = await b.newContext({ viewport: { width: 1920, height: 1080 } }); await c.addCookies([{ name: 'dragonflight.sid', value: COOKIE, domain: 'mediacmdr.com', path: '/', httpOnly: true, secure: true }]); const p = await c.newPage(); // 1. RECORDER — click on a specific port card (with SIGNAL badge) to expand it await p.goto('https://mediacmdr.com/#recorders', { waitUntil: 'networkidle' }); await p.waitForTimeout(4000); // Find a port card that has SIGNAL indicator and click it const portClicked = await p.evaluate(() => { // Look for individual port cards (not the node header) const ports = [...document.querySelectorAll('[class*=port],[class*=recorder-card],[class*=channel]')] .filter(e => e.offsetHeight > 30 && e.offsetHeight < 300 && /SIGNAL/.test(e.innerText)); if (ports.length > 0) { ports[0].click(); return ports[0].innerText.replace(/\s+/g,' ').slice(0,80); } // Fallback: click any element that looks like a port name const named = [...document.querySelectorAll('*')] .filter(e => e.offsetHeight > 20 && e.offsetHeight < 100 && /dragon\d-dc\d|Client|ProTour/.test(e.innerText) && e.children.length < 5); if (named.length > 2) { named[2].click(); return named[2].innerText.replace(/\s+/g,' ').slice(0,60); } return null; }); console.log('Port clicked:', portClicked); await p.waitForTimeout(3000); await pause(p); await p.screenshot({ path: `${OUT}/05b-recorder-port-detail.png` }); // Dump what's shown const portDetail = await p.evaluate(() => (document.querySelector('main') || document.body).innerText.replace(/\n{2,}/g,'\n').slice(0,2000)); console.log('Port detail:', portDetail.slice(0,500)); // Try clicking "Create Recording" to see that dialog const crBtn = await p.evaluate(() => { const b = [...document.querySelectorAll('button')].find(b => /create recording/i.test(b.innerText)); if (b) { b.click(); return true; } return false; }); if (crBtn) { await p.waitForTimeout(2500); await p.screenshot({ path: `${OUT}/05c-create-recording-dialog.png` }); console.log('Create Recording dialog captured'); await p.evaluate(() => { const c = document.querySelector('[class*=modal] button, [class*=close]'); if(c) c.click(); }); await p.waitForTimeout(1000); } // 2. SCHEDULE — "New schedule" modal await p.goto('https://mediacmdr.com/#schedule', { waitUntil: 'networkidle' }); await p.waitForTimeout(4000); await p.evaluate(() => { const b = [...document.querySelectorAll('button')].find(b => /new schedule/i.test(b.innerText)); if (b) b.click(); }); await p.waitForTimeout(2500); await p.screenshot({ path: `${OUT}/06b-schedule-new-event.png` }); // Dump dialog content const schedDialog = await p.evaluate(() => { const d = document.querySelector('[class*=modal],[class*=dialog],[class*=sheet]'); return d ? d.innerText.replace(/\n{2,}/g,'\n').slice(0,1000) : 'no dialog'; }); console.log('Schedule dialog:', schedDialog); // Close await p.evaluate(() => { const c = document.querySelector('button[class*=close], [class*=modal] button:last-child'); if(c) c.click(); }); // "Record now" button await p.waitForTimeout(1000); await p.evaluate(() => { const b = [...document.querySelectorAll('button')].find(b => /record now/i.test(b.innerText)); if (b) b.click(); }); await p.waitForTimeout(2500); await p.screenshot({ path: `${OUT}/06d-schedule-record-now.png` }); const recordDialog = await p.evaluate(() => { const d = document.querySelector('[class*=modal],[class*=dialog],[class*=sheet]'); return d ? d.innerText.replace(/\n{2,}/g,'\n').slice(0,1000) : 'no dialog'; }); console.log('Record now dialog:', recordDialog); // 3. REFRAME page — already captured but let me get a better one with content await p.goto('https://mediacmdr.com/reframe.html', { waitUntil: 'networkidle' }); await p.waitForTimeout(4000); await pause(p); await p.screenshot({ path: `${OUT}/41-reframe.png` }); // 4. AI ANALYSIS — navigate to library, open an asset, click AI Analysis tab await p.goto('https://mediacmdr.com/#library?project=5ebf74aa-f5b4-4a83-b089-c9af2cb25d1f', { waitUntil: 'networkidle' }); await p.waitForTimeout(5000); // Open the Sizzle asset const opened = await p.evaluate(() => { const els = [...document.querySelectorAll('*')] .filter(e => e.offsetHeight > 30 && e.offsetHeight < 400 && /Sizzle/i.test(e.innerText) && e.children.length < 8); if (els.length) { els[0].click(); els[0].dispatchEvent(new MouseEvent('dblclick', { bubbles: true })); return els[0].innerText.slice(0,60); } return null; }); console.log('Opened:', opened); await p.waitForTimeout(6000); // Click AI Analysis tab const aiTab = await p.evaluate(() => { const t = [...document.querySelectorAll('button,[role=tab],div')] .filter(e => e.offsetHeight > 0 && e.children.length < 3) .find(e => /AI Analysis/.test(e.innerText)); if (t) { t.click(); return t.innerText.trim(); } return null; }); console.log('AI tab:', aiTab); await p.waitForTimeout(4000); await pause(p); await p.screenshot({ path: `${OUT}/42-asset-ai-analysis.png` }); // Get the AI analysis content const aiContent = await p.evaluate(() => (document.querySelector('main') || document.body).innerText.replace(/\n{2,}/g,'\n').slice(0,2000)); console.log('AI content:', aiContent.slice(0, 800)); await b.close(); })();