screenshot-group-ops-modals2.py 953 B

123456789101112131415161718192021222324252627282930
  1. from playwright.sync_api import sync_playwright
  2. import time
  3. with sync_playwright() as p:
  4. browser = p.chromium.launch(headless=True)
  5. page = browser.new_page(viewport={'width': 1440, 'height': 900})
  6. page.goto('http://127.0.0.1:4320/')
  7. time.sleep(2)
  8. page.click('text=社群运营')
  9. time.sleep(2)
  10. page.click('text=SOP 版本')
  11. time.sleep(1)
  12. # Test confirm modal by clicking 发布
  13. page.click('text=发布')
  14. time.sleep(1)
  15. page.screenshot(path='/tmp/qiwei-group-ops-confirm-modal2.png', full_page=False)
  16. # Close with cancel
  17. page.click('button:has-text("取消")')
  18. time.sleep(0.5)
  19. # Test prompt modal by clicking 新版本
  20. page.click('text=新版本')
  21. time.sleep(1)
  22. page.screenshot(path='/tmp/qiwei-group-ops-prompt-modal2.png', full_page=False)
  23. # Close with cancel
  24. page.click('button:has-text("取消")')
  25. time.sleep(0.5)
  26. browser.close()
  27. print('screenshots saved')