const {chromium}=require('playwright'); const fs=require('fs'); (async()=>{ const b=await chromium.launch({headless:true,executablePath:'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'}); const p=await b.newPage({viewport:{width:1200,height:900}}); const errors=[]; p.on('pageerror',e=>errors.push(e.message)); await p.goto('http://127.0.0.1:8931/AI%E5%BF%AB%E9%80%9F%E6%8A%A5%E4%BB%B7_Demo2.html?v=material-test',{waitUntil:'load'}); const d=fs.readFileSync('C:/Users/miao/Downloads/494f54100a93c5a6e0c90f404c597514.jpeg').toString('base64'); await p.evaluate(d=>{qUploadedDrawing={name:'test.jpeg',type:'image/jpeg'};qUploadedDrawingUrl='data:image/jpeg;base64,'+d;qUploadedDrawingDataUrl=qUploadedDrawingUrl;qStartAnalysis();},d); await p.waitForTimeout(300); await p.locator('.q-furniture-tool').first().click(); await p.evaluate(()=>qProceedFurnitureToDimensions()); await p.waitForTimeout(300); const initial=await p.locator('.q-material-select').count(); await p.locator('.q-material-select').first().selectOption({label:'铝格栅板'}); await p.evaluate(()=>{window.prompt=()=> '实木多层板';}); await p.locator('.q-material-select').first().selectOption('__custom__'); await p.waitForTimeout(200); const result=await p.evaluate(()=>({count:document.querySelectorAll('.q-material-select').length,selected:document.querySelector('.q-material-select').value,allHaveCustom:[...document.querySelectorAll('.q-material-select')].every(s=>[...s.options].some(o=>o.value==='实木多层板')),roomMaterial:window._qLastAnalysisData.rooms[0].material,saved:localStorage.getItem(Q_CABINET_MATERIALS_KEY)})); console.log(JSON.stringify({initial,...result,errors})); await b.close(); })().catch(e=>{console.error(e);process.exit(1)});