feat: 根目录文档、脚本、gitignore
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# -*- 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 run(page, prog_label, cname):
|
||||
page.goto(BASE + '/#/territory', wait_until='domcontentloaded'); page.wait_for_timeout(3000)
|
||||
page.goto(f'{BASE}/#/worktime/count', wait_until='domcontentloaded'); page.wait_for_timeout(6000)
|
||||
page.locator('.el-tabs__item:has-text("月报"):visible').first.click(); page.wait_for_timeout(4000)
|
||||
page.locator('.el-select:visible').nth(1).click(); page.wait_for_timeout(1500)
|
||||
page.locator(f'.el-select-dropdown:visible li:has-text("{prog_label}")').first.click(); page.wait_for_timeout(1000)
|
||||
mi = page.locator('input[placeholder="选择月"]:visible').first
|
||||
mi.click(); page.wait_for_timeout(800)
|
||||
mi.fill('2026-06'); page.keyboard.press('Enter'); page.wait_for_timeout(1200)
|
||||
page.locator('button:has-text("查询"):visible').first.click()
|
||||
try:
|
||||
page.wait_for_selector(f'tr:has-text("{cname}")', timeout=20000)
|
||||
except Exception:
|
||||
return None
|
||||
page.wait_for_timeout(1500)
|
||||
page.locator(f'tr:has-text("{cname}")').first.locator('button:has-text("绩效")').first.click()
|
||||
page.wait_for_timeout(12000)
|
||||
body = page.locator('body').inner_text()
|
||||
page.screenshot(path=f'tmp/pw_chg053_{prog_label}_jun.png', full_page=True)
|
||||
page.keyboard.press('Escape'); page.wait_for_timeout(1500)
|
||||
try:
|
||||
page.locator('.el-dialog__wrapper:visible').first.wait_for(state='hidden', timeout=4000)
|
||||
except Exception:
|
||||
page.reload(wait_until='domcontentloaded'); page.wait_for_timeout(4000)
|
||||
return body
|
||||
with sync_playwright() as p:
|
||||
b = p.chromium.launch(channel='chrome', headless=True)
|
||||
page = b.new_page(viewport={'width': 1600, 'height': 1000})
|
||||
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)
|
||||
r139 = run(page, '139', '孙世超')
|
||||
if r139 is None:
|
||||
print('[139] 无行')
|
||||
else:
|
||||
print('[139 6月] 556.83:', '556.83' in r139, ' 525h:', '525h' in r139, ' 92.35%:', '92.35%' in r139)
|
||||
r119 = run(page, '119', '孙世超')
|
||||
print('[119 6月]', '无行(预期)' if r119 is None else ('630h: ' + str('630h' in r119)))
|
||||
b.close()
|
||||
print('done')
|
||||
Reference in New Issue
Block a user