probe-channel.mjs 1.2 KB

12345678910111213141516171819202122232425
  1. import { chromium } from 'playwright'
  2. const b = await chromium.launch()
  3. const ctx = await b.newContext({ viewport: { width: 1400, height: 900 } })
  4. const p = await ctx.newPage()
  5. await p.goto('http://localhost:8080/')
  6. await p.fill('input[placeholder="请输入账号"]', 'admin')
  7. await p.fill('input[placeholder="请输入密码"]', '123456')
  8. await p.click('button.login-btn')
  9. await p.waitForTimeout(1500)
  10. await p.goto('http://localhost:8080/#/customization/hsbc/channel')
  11. await p.waitForTimeout(1500)
  12. await p.click('button:has-text("新建 Channel")')
  13. await p.waitForTimeout(800)
  14. const r = await p.evaluate(() => {
  15. const sel = document.querySelector('.el-dialog .inline-field .el-select')
  16. const wrap = sel?.querySelector('.el-select__wrapper')
  17. const parent = sel?.parentElement
  18. return {
  19. inlineField: parent ? { display: getComputedStyle(parent).display, w: getComputedStyle(parent).width } : null,
  20. selectRoot: sel ? { display: getComputedStyle(sel).display, w: getComputedStyle(sel).width, flex: getComputedStyle(sel).flex, minW: getComputedStyle(sel).minWidth } : null,
  21. selectWrapper: wrap ? { display: getComputedStyle(wrap).display, w: getComputedStyle(wrap).width } : null
  22. }
  23. })
  24. console.log(JSON.stringify(r, null, 2))
  25. await b.close()