Skip to content

Releases: microsoft/playwright-dotnet

v1.44.0

17 May 10:06
Compare
Choose a tag to compare

New APIs

Accessibility assertions

  • Expect(locator).ToHaveAccessibleNameAsync() checks if the element has the specified accessible name:

    var locator = Page.GetByRole(AriaRole.Button);
    await Expect(locator).ToHaveAccessibleNameAsync("Submit");
  • Expect(locator).ToHaveAccessibleDescriptionAsync() checks if the element has the specified accessible description:

    var locator = Page.GetByRole(AriaRole.Button);
    await Expect(locator).ToHaveAccessibleDescriptionAsync("Upload a photo");
  • Expect(locator).ToHaveRoleAsync() checks if the element has the specified ARIA role:

    var locator = Page.GetByTestId("save-button");
    await Expect(locator).ToHaveRoleAsync(AriaRole.Button);

Locator handler

var locator = Page.GetByText("This interstitial covers the button");
await Page.AddLocatorHandlerAsync(locator, async (overlay) =>
{
    await overlay.Locator("#close").ClickAsync();
}, new() { Times = 3, NoWaitAfter = true });
// Run your tests that can be interrupted by the overlay.
// ...
await Page.RemoveLocatorHandlerAsync(locator);

Miscellaneous options

  • Multipart option in APIRequestContext.FetchAsync() supports now repeating fields with the same name using formData.append():

    var formData = Context.APIRequest.CreateFormData();
    formData.Append("file", new FilePayload()
    {
        Name = "f1.js",
        MimeType = "text/javascript",
        Buffer = System.Text.Encoding.UTF8.GetBytes("var x = 2024;")
    });
    formData.Append("file", new FilePayload()
    {
        Name = "f2.txt",
        MimeType = "text/plain",
        Buffer = System.Text.Encoding.UTF8.GetBytes("hello")
    });
    var response = await Context.APIRequest.PostAsync("https://example.com/uploadFiles", new() { Multipart = formData });
  • Expect(page).ToHaveURLAsync() now supports IgnoreCase option.

Browser Versions

  • Chromium 125.0.6422.14
  • Mozilla Firefox 125.0.1
  • WebKit 17.4

This version was also tested against the following stable channels:

  • Google Chrome 124
  • Microsoft Edge 124

v1.43.0

09 Apr 19:34
98e3755
Compare
Choose a tag to compare

New APIs

  • Method BrowserContext.ClearCookiesAsync() now supports filters to remove only some cookies.

    // Clear all cookies.
    await Context.ClearCookiesAsync();
    // New: clear cookies with a particular name.
    await Context.ClearCookiesAsync(new() { Name = "session-id" });
    // New: clear cookies for a particular domain.
    await Context.ClearCookiesAsync(new() { Domain = "my-origin.com" });
  • New property Locator.ContentFrame converts a Locator object to a FrameLocator. This can be useful when you have a Locator object obtained somewhere, and later on would like to interact with the content inside the frame.

    var locator = Page.Locator("iframe[name='embedded']");
    // ...
    var frameLocator = locator.ContentFrame;
    await frameLocator.GetByRole(AriaRole.Button).ClickAsync();
  • New property FrameLocator.Owner converts a FrameLocator object to a Locator. This can be useful when you have a FrameLocator object obtained somewhere, and later on would like to interact with the iframe element.

    var frameLocator = page.FrameLocator("iframe[name='embedded']");
    // ...
    var locator = frameLocator.Owner;
    await Expect(locator).ToBeVisibleAsync();

Browser Versions

  • Chromium 124.0.6367.8
  • Mozilla Firefox 124.0
  • WebKit 17.4

This version was also tested against the following stable channels:

  • Google Chrome 123
  • Microsoft Edge 123

v1.42.0

07 Mar 16:39
913fbd3
Compare
Choose a tag to compare

New Locator Handler

New method page.addLocatorHandler(locator, handler, handler, handler) registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears.

// Setup the handler.
await Page.AddLocatorHandlerAsync(
    Page.GetByRole(AriaRole.Heading, new() { Name = "Hej! You are in control of your cookies." }),
    async () =>
    {
        await Page.GetByRole(AriaRole.Button, new() { Name = "Accept all" }).ClickAsync();
    });
// Write the test as usual.
await Page.GotoAsync("https://www.ikea.com/");
await Page.GetByRole(AriaRole.Link, new() { Name = "Collection of blue and white" }).ClickAsync();
await Expect(Page.GetByRole(AriaRole.Heading, new() { Name = "Light and easy" })).ToBeVisibleAsync();

New APIs

Announcements

  • ⚠️ Ubuntu 18 is not supported anymore.

Browser Versions

  • Chromium 123.0.6312.4
  • Mozilla Firefox 123.0
  • WebKit 17.4

This version was also tested against the following stable channels:

  • Google Chrome 122
  • Microsoft Edge 123

v1.41.2

24 Jan 23:08
ef31243
Compare
Choose a tag to compare

Highlights

microsoft/playwright#29067 - [REGRESSION] Codegen/Recorder: not all clicks are being actioned nor recorded
microsoft/playwright#29019 - [REGRESSION] trace.playwright.dev does not currently support the loading from URL

Browser Versions

  • Chromium 121.0.6167.57
  • Mozilla Firefox 121.0
  • WebKit 17.4

This version was also tested against the following stable channels:

  • Google Chrome 120
  • Microsoft Edge 120

v1.41.1

18 Jan 16:43
10e8f3b
Compare
Choose a tag to compare

Highlights

  • [REGRESSION] - ChromiumSandbox protocol mismatch (#2794 (comment))
  • [REGRESSION] - Build with non-trailing slash output directory (#2827)
  • [REGRESSION] - QuerySelectorAll on .NET 6 (#2830)

Browser Versions

  • Chromium 121.0.6167.57
  • Mozilla Firefox 121.0
  • WebKit 17.4

This version was also tested against the following stable channels:

  • Google Chrome 120
  • Microsoft Edge 120

v1.41.0

17 Jan 09:39
e964457
Compare
Choose a tag to compare

New APIs

Browser Versions

  • Chromium 121.0.6167.57
  • Mozilla Firefox 121.0
  • WebKit 17.4

This version was also tested against the following stable channels:

  • Google Chrome 120
  • Microsoft Edge 120

v1.40.0

21 Nov 21:56
cbef904
Compare
Choose a tag to compare

Test Generator Update

Playwright Test Generator

New tools to generate assertions:

Here is an example of a generated test with assertions:

await Page.GotoAsync("https://playwright.dev/");
await Page.GetByRole(AriaRole.Link, new() { Name = "Get started" }).ClickAsync();
await Expect(Page.GetByLabel("Breadcrumbs").GetByRole(AriaRole.List)).ToContainTextAsync("Installation");
await Expect(Page.GetByLabel("Search")).ToBeVisibleAsync();
await Page.GetByLabel("Search").ClickAsync();
await Page.GetByPlaceholder("Search docs").FillAsync("locator");
await Expect(Page.GetByPlaceholder("Search docs")).ToHaveValueAsync("locator");

New APIs

Other Changes

Potential breaking changes

When using Microsoft.Playwright.MSTest or Microsoft.Playwright.NUnit, Locale and ColorScheme were taken from the operating system as a default. After v1.40, its now aligned with Playwright for Node.js to en-US and light. In order to opt-in for the previous behaviour, the ContextOptions method can be overidden.

using Microsoft.Playwright.NUnit;

namespace PlaywrightTests;

[Parallelizable(ParallelScope.Self)]
[TestFixture]
public class MyTest : PageTest
{
    public override BrowserNewContextOptions ContextOptions()
    {
        return new BrowserNewContextOptions()
        {
            Locale = "en-GB",
            ColorScheme = ColorScheme.Light,
        };
    }
}

Browser Versions

  • Chromium 120.0.6099.28
  • Mozilla Firefox 119.0
  • WebKit 17.4

This version was also tested against the following stable channels:

  • Google Chrome 119
  • Microsoft Edge 119

v1.39.0

16 Oct 08:53
eade3f5
Compare
Choose a tag to compare

Evergreen browsers update.

Browser Versions

  • Chromium 119.0.6045.9
  • Mozilla Firefox 118.0.1
  • WebKit 17.4

This version was also tested against the following stable channels:

  • Google Chrome 118
  • Microsoft Edge 118

v1.38.0

19 Sep 09:33
Compare
Choose a tag to compare

Trace Viewer Updates

Playwright Trace Viewer

  1. Zoom into time range.
  2. Network panel redesign.

New APIs

Deprecations

Browser Versions

  • Chromium 117.0.5938.62
  • Mozilla Firefox 117.0
  • WebKit 17.0

This version was also tested against the following stable channels:

  • Google Chrome 116
  • Microsoft Edge 116

v1.37.1

16 Aug 08:26
5400658
Compare
Choose a tag to compare

Fixes:

  • [REGRESSION]: Playwright.CreateAsync() did not work in applications without a Console. (#2663)