我希望剧作家早点失败,并在一个 http 请求不是200
或时停止302
。
def test_it(live_server):
os.environ['DEBUG']='pw:api'
with sync_playwright() as playwright:
run_test_id(live_server, playwright)
def run_test_id(live_server, playwright):
browser = playwright.webkit.launch(headless=False)
context = browser.new_context()
page = context.new_page()
page.goto(live_server.url)
page.click("text=Create Test Data")
不幸的是page.click()
返回无,所以我不知道如何检查点击的 http 状态。
如何在 Playwright 中实现“异常 http 状态失败”?