import re from playwright.sync_api import Playwright, sync_playwright, expect def run(playwright: Playwright) -> None: browser = playwright.chromium.launch(headless=False) context = browser.new_context() page = context.new_page() page.goto("about:blank") page.goto("http://ankangfulu.yhz.com/") page.goto("http://ankangfulu.yhz.com/login") page.get_by_placeholder("请输入手机号").click() page.get_by_placeholder("请输入手机号").fill("1") page.get_by_placeholder("请输入手机号").press("F1") page.get_by_placeholder("请输入手机号").fill("18611659484") page.get_by_placeholder("请输入手机号").press("Tab") page.get_by_placeholder("请选择诊所名称").click() page.get_by_text("厚生堂(测试)诊所").click() page.get_by_placeholder("请输入密码").click() page.get_by_placeholder("请输入密码").fill("admin123") page.get_by_placeholder("请输入密码").press("Enter") page.locator('.ivu-menu').get_by_text("收银").click() page.get_by_text("诊所管理").click() page.locator("#app").get_by_text("医生管理").click() page.locator("tr").filter(has_text="查看编辑出诊分享权重 孙医生 18611659484").locator("i").nth(2).click() page.get_by_role("button", name="引用通用排班").click() page.get_by_role("button", name="确定").click() page.get_by_role("button", name="保存").click() page.get_by_text("医生工作台").click() page.locator("li").filter(has_text="收银 挂号/加号工作台患者管理会员卡办理商品核销文章管理抄方开药预收款管理 预收款账户管理预收款账户充值").locator("div").first.click() page.locator("#app").get_by_text("挂号/加号").click() page.locator("#main-content").get_by_text("孙医生").click() page.locator("li").filter(has_text="12上午:0/10 下午:0/20 挂号/加号").get_by_role("button").click() page.get_by_placeholder("最多20个字符").click() page.get_by_placeholder("最多20个字符").fill("19920002680") page.locator(".ivu-row > div:nth-child(2)").first.click() page.get_by_placeholder("位手机号码").click() page.get_by_placeholder("最多20个字符").click() page.get_by_placeholder("最多20个字符").fill("患者1") page.get_by_text("患者信息 读取身份证读卡会自动完善新患者姓名、性别、年龄、生日、省份、住址,老患者已经完善信息不覆盖。患者姓名: 3/20").click() page.get_by_placeholder("位手机号码").click() page.get_by_placeholder("位手机号码").fill("19920002680") page.locator(".ivu-select-selection").first.click() page.get_by_text("男").click() page.get_by_placeholder("仅支持数字").first.click() page.get_by_placeholder("仅支持数字").first.fill("34") page.get_by_role("button", name="去支付").click() page.get_by_role("button", name="确定").click() page.get_by_text("现金").click() page.get_by_role("button", name="确定支付").click() page.get_by_role("button", name="知道了").click() # --------------------- context.close() browser.close() with sync_playwright() as playwright: run(playwright)