screenshot-group-ops-modals3.py 903 B

12345678910111213141516171819202122232425
  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. # Find publish button
  13. btn = page.query_selector('[data-group-ops-publish]')
  14. print('publish button found:', btn is not None)
  15. if btn:
  16. print('dataset:', btn.evaluate('el => el.dataset.groupOpsPublish'))
  17. btn.click()
  18. time.sleep(2)
  19. page.screenshot(path='/tmp/qiwei-group-ops-confirm-modal3.png', full_page=False)
  20. # Try to find any modal
  21. modal = page.query_selector('.business-modal, .modal')
  22. print('modal found:', modal is not None)
  23. browser.close()
  24. print('done')