Playwright + Python · Lesson 19 of 37
Module 19: Auto-Waiting & Synchronization
Your task
Implement wait_for_destination(page, url_pattern):
Write it in the editor, then press Check answer (Ctrl + Enter).
Before click(), Playwright checks:
with page.expect_response("**/api/cart/add"):
page.get_by_role("button", name="Add to Cart").click()
page.wait_for_url("**/dashboard")Say goodbye to time.sleep forever! Before executing any action, Playwright verifies that the target element is attached, visible, stable, enabled, and receiving pointer events. In this lesson, you will master actionability and synchronization. Let's eliminate flakiness!
Part of the Playwright + Python course (Playwright with Python). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.
Never! time.sleep() wastes CI compute and still risks race conditions. Use Playwright's auto-waiting or expect_response.
Ready? Solve the task in the editor
Use Check answer to mark it complete. Hints are there if you need them.
___