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