|
|
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("http://127.0.0.1:9191/app/") |
|
|
page.get_by_text("English -> Chinese").click() |
|
|
page.get_by_text("Chinese -> English").click() |
|
|
page.locator("#app").get_by_title("Chinese -> English").click() |
|
|
page.get_by_text("Chinese -> English").nth(1).click() |
|
|
page.get_by_role("switch", name="ON OFF").click() |
|
|
page.locator("#app").get_by_text("Chinese -> English").click() |
|
|
page.get_by_text("Chinese -> English").nth(1).click() |
|
|
|
|
|
|
|
|
context.close() |
|
|
browser.close() |
|
|
|
|
|
|
|
|
with sync_playwright() as playwright: |
|
|
run(playwright) |