20 lines
971 B
Python
20 lines
971 B
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:8089'
|
|
with sync_playwright() as p:
|
|
b = p.chromium.launch(channel='chrome', headless=True, args=['--start-maximized'])
|
|
page = b.new_page(viewport={'width': 1500, 'height': 950})
|
|
page.goto(BASE, wait_until='domcontentloaded'); page.wait_for_timeout(2000)
|
|
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-story-info/6566', wait_until='domcontentloaded')
|
|
page.wait_for_timeout(6000)
|
|
sec = page.locator('.fs18.fw6:has-text("AI 指标")').first
|
|
sec.scroll_into_view_if_needed(); page.wait_for_timeout(800)
|
|
page.screenshot(path='tmp/pw_6566_ai_block.png')
|
|
b.close()
|
|
print('ok')
|