29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
import io, sys
|
|
from playwright.sync_api import sync_playwright
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
BASE = 'http://localhost:8088'
|
|
def on_resp(resp):
|
|
if 'fileList' in resp.url:
|
|
try:
|
|
print('fileList RESP', resp.status, resp.text()[:200])
|
|
except Exception:
|
|
pass
|
|
with sync_playwright() as p:
|
|
b = p.chromium.launch(channel='chrome', headless=True)
|
|
page = b.new_page(viewport={'width': 1600, 'height': 1000})
|
|
page.on('response', on_resp)
|
|
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(8000)
|
|
page.goto(f'{BASE}/#/product-story-info/6566', wait_until='domcontentloaded'); page.wait_for_timeout(15000)
|
|
loc = page.locator('text="需求文档"').first
|
|
if loc.count():
|
|
loc.scroll_into_view_if_needed(); page.wait_for_timeout(3000)
|
|
body = page.locator('body').inner_text()
|
|
print('文件展示:', '需求文档-6566-测试' in body)
|
|
page.screenshot(path='tmp/pw_chg058_6566.png', full_page=True)
|
|
b.close()
|
|
print('done')
|