You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
const { chromium } = require('playwright');
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const page = await browser.newPage();
|
|
|
|
// 登录
|
|
await page.goto('http://127.0.0.1/admin/login');
|
|
await page.waitForTimeout(500);
|
|
await page.fill('input[type="text"]', 'admin');
|
|
await page.fill('input[type="password"]', 'admin123');
|
|
await page.click('button:has-text("登录")');
|
|
await page.waitForTimeout(2000);
|
|
|
|
// 导航到产量报表
|
|
await page.goto('http://127.0.0.1/admin/production');
|
|
await page.waitForTimeout(3000);
|
|
|
|
// 获取el-date-picker内部真实值
|
|
const result = await page.evaluate(() => {
|
|
const inputs = document.querySelectorAll('.el-date-editor input');
|
|
const startInput = inputs[0];
|
|
const endInput = inputs[1];
|
|
|
|
// 获取Vue组件实例
|
|
const pickerEl = document.querySelector('.el-date-editor');
|
|
const vueInstance = pickerEl?.__vue__;
|
|
|
|
return {
|
|
startInputValue: startInput?.value,
|
|
endInputValue: endInput?.value,
|
|
startInputType: startInput?.type,
|
|
vueModelValue: vueInstance ? JSON.stringify(vueInstance.modelValue || vueInstance.$props?.modelValue) : 'no vue instance',
|
|
// 直接读input的placeholder
|
|
startPlaceholder: startInput?.placeholder,
|
|
endPlaceholder: endInput?.placeholder,
|
|
};
|
|
});
|
|
|
|
console.log('日期选择器状态:', JSON.stringify(result, null, 2));
|
|
|
|
// 检查raw HTML
|
|
const rawHtml = await page.evaluate(() => {
|
|
const picker = document.querySelector('.el-date-editor');
|
|
return picker?.outerHTML?.substring(0, 500);
|
|
});
|
|
console.log('\nraw HTML:', rawHtml);
|
|
|
|
await browser.close();
|
|
})();
|