25 lines
1.3 KiB
Python
25 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: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(7000)
|
|
page.goto(f'{BASE}/#/worktime/count', wait_until='domcontentloaded'); page.wait_for_timeout(5000)
|
|
# 月报 tab → 查询郭尚雨行 → 点绩效
|
|
page.locator('.el-tabs__item:has-text("月报")').first.click(); page.wait_for_timeout(3000)
|
|
row = page.locator('tr:has-text("郭尚雨")').first
|
|
if row.count():
|
|
row.locator('button:has-text("绩效")').first.click(); page.wait_for_timeout(4000)
|
|
page.screenshot(path='tmp/pw_perf_text.png', full_page=True)
|
|
print('截图完成')
|
|
else:
|
|
page.screenshot(path='tmp/pw_perf_text.png')
|
|
print('未找到郭尚雨行(月份/产品集过滤)')
|
|
b.close()
|