18. Web-First Auto-Retrying Assertions with expect()

Web-First Auto-Retrying Assertions

from playwright.sync_api import expect

expect(page).to_have_url("https://targetqa.com/dashboard")
expect(page).to_have_title("Dashboard - TargetQA")

welcome_msg = page.get_by_role("heading")
expect(welcome_msg).to_be_visible()
expect(welcome_msg).to_have_text("Welcome back!")

Task

  • Implement verify_dashboard_elements(page, expected_url):
  • 1. expect(page).to_have_url(expected_url)
  • 2. expect(page.get_by_role("heading")).to_be_visible()
πŸ’‘Common doubts
Did you like the problem?
Lesson 18 of 37
Python
Loading code editor…
Next