| 1234567891011121314151617181920212223242526272829303132 |
- import { chromium } from 'playwright'
- const b = await chromium.launch()
- const ctx = await b.newContext({ viewport: { width: 1600, 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(2500)
- // inspect first quill-editor
- const html = await p.evaluate(() => {
- const el = document.querySelector('.ql-toolbar')
- if (!el) return 'no toolbar'
- const root = el.parentElement
- return {
- rootTag: root.tagName,
- rootClass: root.className,
- rootStyle: getComputedStyle(root).cssText.slice(0, 400),
- childCount: root.children.length,
- children: Array.from(root.children).map(c => ({
- tag: c.tagName,
- cls: c.className,
- display: getComputedStyle(c).display,
- width: getComputedStyle(c).width,
- height: getComputedStyle(c).height
- }))
- }
- })
- console.log(JSON.stringify(html, null, 2))
- await b.close()
|