| 12345678910111213141516171819202122232425262728 |
- import { chromium } from 'playwright'
- const b = await chromium.launch()
- const ctx = await b.newContext({ viewport: { width: 1400, height: 900 } })
- const p = await ctx.newPage()
- await p.goto('http://localhost:8080/')
- await p.fill('input[placeholder="请输入账号"]', 'admin')
- await p.fill('input[placeholder="请输入密码"]', '123456')
- await p.click('button.login-btn')
- await p.waitForTimeout(1500)
- await p.goto('http://localhost:8080/#/customization/hsbc/equity-products/add')
- await p.waitForTimeout(2000)
- const r = await p.evaluate(() => {
- const tb = document.querySelector('.ql-toolbar')
- const root = tb?.parentElement // .quill-editor wrapper
- const formItem = root?.closest('.el-form-item')
- const formItemContent = root?.closest('.el-form-item__content')
- const editor = document.querySelector('.ql-editor')
- return {
- root: root ? { cls: root.className, display: getComputedStyle(root).display, w: getComputedStyle(root).width, h: getComputedStyle(root).height, position: getComputedStyle(root).position } : null,
- formItem: formItem ? { h: getComputedStyle(formItem).height, mb: getComputedStyle(formItem).marginBottom } : null,
- formItemContent: formItemContent ? { h: getComputedStyle(formItemContent).height, display: getComputedStyle(formItemContent).display } : null,
- toolbar: tb ? { h: getComputedStyle(tb).height } : null,
- container: document.querySelector('.ql-container') ? { h: getComputedStyle(document.querySelector('.ql-container')).height, position: getComputedStyle(document.querySelector('.ql-container')).position } : null,
- editor: editor ? { h: getComputedStyle(editor).height, minH: getComputedStyle(editor).minHeight } : null
- }
- })
- console.log(JSON.stringify(r, null, 2))
- await b.close()
|