You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

24 lines
980 B

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("https://oishi-kenko.com/recipes")
page.get_by_text("ねぎたっぷり 塩牛丼").click()
page.get_by_role("heading", name="ねぎたっぷり 塩牛丼").click()
page.get_by_role("heading", name="ねぎたっぷり 塩牛丼").click(button="right")
expect(page.get_by_role("article")).to_contain_text("ねぎたっぷり 塩牛丼")
page.get_by_role("article").locator("li").filter(has_text="糖尿病").locator("div").click()
expect(page.get_by_role("article")).to_contain_text("糖尿病")
page.get_by_role("link", name="高血圧", exact=True).click()
page.close()
# ---------------------
context.close()
browser.close()
with sync_playwright() as playwright:
run(playwright)