from playwright.sync_api import sync_playwright import time with sync_playwright() as p: browser = p.chromium.launch(headless=True) page = browser.new_page(viewport={'width': 1440, 'height': 900}) page.goto('http://127.0.0.1:4320/') time.sleep(2) page.click('text=社群运营') time.sleep(2) page.click('text=SOP 版本') time.sleep(1) page.screenshot(path='/tmp/qiwei-group-ops-sop.png', full_page=False) # Create SOP page.fill('#group-ops-playbook-name', '测试SOP') page.fill('#group-ops-template', '欢迎加入 {{room_name}}') page.click('#group-ops-playbook-form button[type="submit"]') time.sleep(2) page.screenshot(path='/tmp/qiwei-group-ops-sop-created.png', full_page=False) # Click 影响预览 page.click('text=影响预览') time.sleep(1) page.screenshot(path='/tmp/qiwei-group-ops-alert-modal.png', full_page=False) # Close alert page.click('button:has-text("知道了")') time.sleep(0.5) # Click 发布 page.click('text=发布') time.sleep(1) page.screenshot(path='/tmp/qiwei-group-ops-confirm-modal.png', full_page=False) # Cancel page.click('button:has-text("取消")') time.sleep(0.5) # Click 新版本 page.click('text=新版本') time.sleep(1) page.screenshot(path='/tmp/qiwei-group-ops-prompt-modal.png', full_page=False) browser.close() print('screenshots saved')