// tds1 浏览器层深度 debug — 抓 console + network + DOM import { chromium } from 'playwright' const browser = await chromium.launch({ headless: true }) const page = await browser.newPage({ viewport: { width: 1440, height: 900 } }) const consoleMessages = [] const networkErrors = [] page.on('console', msg => consoleMessages.push({ type: msg.type(), text: msg.text() })) page.on('pageerror', err => consoleMessages.push({ type: 'pageerror', text: err.message })) page.on('response', resp => { if (resp.status() >= 400) networkErrors.push({ url: resp.url(), status: resp.status() }) }) try { await page.goto('http://nginx/', { waitUntil: 'domcontentloaded', timeout: 30000 }) await page.waitForTimeout(2000) await page.locator('input[placeholder*="账号"], input[placeholder*="账户"]').first().fill('admin') await page.locator('input[type="password"]').first().fill('123456') await page.locator('button:has-text("登录"), button:has-text("登 录")').first().click() await page.waitForTimeout(5000) // 直接到 tds_space_v3 await page.goto('http://nginx/jnpf_app_tds1/model/tds_space_v3', { waitUntil: 'domcontentloaded', timeout: 30000 }) await page.waitForTimeout(10000) // 检查 DOM const dom = await page.evaluate(() => { return { bodyHTML: document.body.innerHTML.slice(0, 5000), vxeTable: document.querySelectorAll('.vxe-table').length, antTable: document.querySelectorAll('.ant-table').length, labels: Array.from(document.querySelectorAll('label, .label, .col-form-label')).map(l => l.textContent?.trim()).filter(Boolean).slice(0, 20), buttons: Array.from(document.querySelectorAll('button')).map(b => b.textContent?.trim()).filter(Boolean).slice(0, 10), mainContent: document.querySelector('.jnpf-content, .main-content, [class*="container"]')?.innerHTML?.slice(0, 1000) || 'none', } }) console.log('=== DOM 检查 ===') console.log('vxe-table 数:', dom.vxeTable) console.log('ant-table 数:', dom.antTable) console.log('labels:', JSON.stringify(dom.labels)) console.log('buttons:', JSON.stringify(dom.buttons)) console.log('main content 前 1000:', dom.mainContent) console.log('\n=== Console Messages ===') for (const m of consoleMessages.slice(0, 30)) { console.log(` [${m.type}] ${m.text.slice(0, 200)}`) } console.log('\n=== Network Errors (4xx/5xx) ===') for (const e of networkErrors.slice(0, 30)) { console.log(` ${e.status} ${e.url}`) } await page.screenshot({ path: '/home/ubuntu/ccWorkDir/docs/tds1/screenshots/debug_tds_space.png', fullPage: true }) } finally { await browser.close() }