const { chromium } = require('playwright'); (async () => { const browser = await chromium.launch({ headless: true }); const page = await browser.newPage(); console.log('=== 测试修复后的输入框 ===\n'); await page.goto('http://localhost:5173/#/pages/video-generator/create', { waitUntil: 'networkidle', timeout: 30000 }); await page.waitForTimeout(3000); // 使用正确的选择器 console.log('1. 使用 .form-input 选择器:'); const inputByClass = await page.locator('.form-input').count(); console.log(` 找到 ${inputByClass} 个元素`); console.log('\n2. 使用 .uni-input 选择器:'); const inputByUni = await page.locator('.uni-input').count(); console.log(` 找到 ${inputByUni} 个元素`); console.log('\n3. 使用 uni-input 选择器:'); const inputByTag = await page.locator('uni-input').count(); console.log(` 找到 ${inputByTag} 个元素`); // 尝试在输入框中输入文字 console.log('\n4. 尝试输入文字:'); try { // 使用原生 input 选择器 await page.locator('input[type="text"]').first().fill('测试标题123'); const value = await page.locator('input[type="text"]').first().inputValue(); console.log(` ✅ 输入成功,值为: "${value}"`); } catch (e) { console.log(` ❌ 输入失败: ${e.message}`); } // 截图 await page.screenshot({ path: 'input-test-result.png', fullPage: true }); console.log('\n5. 已保存截图: input-test-result.png'); await browser.close(); })();