github microsoft/playwright-dotnet v1.51.0

15 hours ago

Highlights

  • New option IndexedDB for BrowserContext.StorageStateAsync() 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.
    await context.StorageStateAsync(new()
    {
        Path = "../../../playwright/.auth/state.json",
        IndexedDB = true
    });
    
    // Create a new context with the saved storage state.
    var context = await browser.NewContextAsync(new()
    {
        StorageStatePath = "../../../playwright/.auth/state.json"
    });
  • New option Visible for locator.filter() allows matching only visible elements.

    // Ignore invisible todo items.
    var todoItems = Page.GetByTestId("todo-item").Filter(new() { Visible = true });
    // Check there are exactly 3 visible ones.
    await Expect(todoItems).ToHaveCountAsync(3);
  • New option Contrast for methods page.emulateMedia() and Browser.NewContextAsync() allows to emulate the prefers-contrast media feature.

  • New option FailOnStatusCode 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-dotnet release

NewReleases is sending notifications on new releases.