You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
827 B
25 lines
827 B
|
2 weeks ago
|
import sys, io
|
||
|
|
from playwright.sync_api import sync_playwright
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||
|
|
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
||
|
|
|
||
|
|
FRONTEND_DIR = "D:/code/crm-backend-matt/.scratch/opportunity-verify/frontend"
|
||
|
|
|
||
|
|
with sync_playwright() as p:
|
||
|
|
browser = p.chromium.launch(headless=True)
|
||
|
|
page = browser.new_page()
|
||
|
|
|
||
|
|
errors = []
|
||
|
|
page.on("console", lambda msg: errors.append(f"[{msg.type}] {msg.text}"))
|
||
|
|
page.on("pageerror", lambda err: errors.append(f"[pageerror] {err}"))
|
||
|
|
|
||
|
|
page.goto(f"file:///{FRONTEND_DIR}/03-list.html")
|
||
|
|
page.wait_for_load_state("networkidle")
|
||
|
|
page.locator("button").first.click()
|
||
|
|
page.wait_for_timeout(5000)
|
||
|
|
|
||
|
|
print("=== 所有 console 消息 ===")
|
||
|
|
for e in errors:
|
||
|
|
print(e)
|
||
|
|
browser.close()
|