30 lines
1.4 KiB
Python
30 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""诊断:抓新增会议弹窗 DOM"""
|
|
import io, sys
|
|
from playwright.sync_api import sync_playwright
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
BASE = 'http://localhost:8088'
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(channel='chrome', headless=True, args=['--disable-gpu'])
|
|
page = browser.new_page(viewport={'width': 1500, 'height': 950})
|
|
page.goto(BASE, wait_until='domcontentloaded'); page.wait_for_timeout(2500)
|
|
page.locator('input[placeholder="用户名"]').fill('admin')
|
|
page.locator('input[placeholder="密码"]').fill('123456')
|
|
page.locator('text="登录"').first.click(); page.wait_for_timeout(6000)
|
|
page.goto(f'{BASE}/#/product-meeting/145', wait_until='domcontentloaded')
|
|
page.wait_for_timeout(5000)
|
|
page.locator('button.el-button--primary:has-text("会议纪要")').first.click()
|
|
page.wait_for_timeout(3000)
|
|
n = page.locator('.el-dialog').count()
|
|
print('dialogs:', n)
|
|
for i in range(min(n, 3)):
|
|
d = page.locator('.el-dialog').nth(i)
|
|
print(f'--- dialog[{i}] visible={d.is_visible()} ---')
|
|
html = d.inner_html()
|
|
io.open(f'tmp/dlg_{i}.html', 'w', encoding='utf-8').write(html)
|
|
# 概要:form-item labels
|
|
labels = d.locator('.el-form-item__label').all_inner_texts()
|
|
print('labels:', labels)
|
|
page.screenshot(path='tmp/rc_dialog_debug.png', full_page=False)
|
|
browser.close()
|