Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Created May 9, 2024 12:13
Show Gist options
  • Save SarahElson/87c7a6080d4475a0baf792098a8c0b6f to your computer and use it in GitHub Desktop.
Save SarahElson/87c7a6080d4475a0baf792098a8c0b6f to your computer and use it in GitHub Desktop.
How to Use Playwright Wait For Navigation Methods
from playwright.sync_api import expect
from fixtures.wait_fixture import page, browser, set_test_status
# page = fixtures.wait_fixture.page
def test_wait_state_navigation(page, set_test_status):
page.goto("https://ecommerce-playground.lambdatest.io/")
# wait for load state wait until naviagtion is complete
page.wait_for_load_state() # load by default
title = page.title()
if "Your Store" in title:
set_test_status(status="passed", remark="Title matched")
else:
set_test_status(status="failed", remark="Title did not match")
expect(page).to_have_title("Your Store")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment