https://playwright.dev/python/docs/intro
1、新建一个python环境
mkdir doubao-playwright
cd doubao-playwright/
python3 -m venv .venv
source .venv/bin/activate2、然后执行
playwright install被告知需要安装一些依赖
playwright install-deps3、然后
import re
from playwright.sync_api import Page, expect
def test_has_title(page: Page):
page.goto("https://playwright.dev/")
# Expect a title "to contain" a substring.
expect(page).to_have_title(re.compile("Playwright"))
def test_get_started_link(page: Page):
page.goto("https://playwright.dev/")
# Click the get started link.
page.get_by_role("link", name="Get started").click()
# Expects page to have a heading with the name of Installation.
expect(page.get_by_role("heading", name="Installation")).to_be_visible()
不知道为啥压根没执行的样子

我草,竟然是单纯因为文件的命名问题
文件名必须以test开头,应该是,这是pytest的约定,应该是
改成test_example.py就OK了