github microsoft/playwright-python v1.51.0

12 hours ago

Highlights

  • New option indexed_db for browserContext.storage_state() allows to save and restore IndexedDB contents. Useful when your application uses IndexedDB API to store authentication tokens, like Firebase Authentication.

    Here is an example following the authentication guide:

    # Save storage state into the file. Make sure to include IndexedDB.
    storage = context.storage_state(path="state.json", indexed_db=True)
    
    # Create a new context with the saved storage state.
    context = browser.new_context(storage_state="state.json")
  • New option visible for locator.filter() allows matching only visible elements.

    # Ignore invisible todo items.
    todo_items = page.get_by_test_id("todo-item").filter(visible=True)
    # Check there are exactly 3 visible ones.
    expect(todo_items).to_have_count(3)
  • New option contrast for methods page.emulate_media() and browser.new_context() allows to emulate the prefers-contrast media feature.

  • New option fail_on_status_code makes all fetch requests made through the APIRequestContext throw on response codes other than 2xx and 3xx.

Browser Versions

  • Chromium 134.0.6998.35
  • Mozilla Firefox 135.0
  • WebKit 18.4

This version was also tested against the following stable channels:

  • Google Chrome 133
  • Microsoft Edge 133

Don't miss a new playwright-python release

NewReleases is sending notifications on new releases.