Skip to content

Releases: microsoft/playwright-dotnet

v1.26.0

20 Sep 22:57
277b6cd
Compare
Choose a tag to compare

Highlights

Assertions

Other highlights

  • New option MaxRedirects for ApiRequestContext.GetAsync(url, options) and others to limit redirect count.
  • Codegen now supports NUnit and MSTest frameworks.
  • ASP .NET is now supported (via packages.config)

Behavior Change

A bunch of Playwright APIs already support the WaitUntil: WaitUntilState.DOMContentLoaded option. For example:

await Page.GotoAsync("https://playwright.dev", new() { WaitUntil = WaitUntilState.DOMContentLoaded });

Prior to 1.26, this would wait for all iframes to fire the DOMContentLoaded event.

To align with web specification, the WaitUntilState.DOMContentLoaded value only waits for the target frame to fire the 'DOMContentLoaded' event. Use WaitUntil: WaitUntilState.Load to wait for all iframes.

Browser Versions

  • Chromium 106.0.5249.30
  • Mozilla Firefox 104.0
  • WebKit 16.0

This version was also tested against the following stable channels:

  • Google Chrome 105
  • Microsoft Edge 105

v1.25.0

15 Aug 16:44
53fac58
Compare
Choose a tag to compare

Highlights

New .runsettings file support

Microsoft.Playwright.NUnit and Microsoft.Playwright.MSTest will now consider the .runsettings file and passed settings via the CLI when running end-to-end tests. See in the documentation for a full list of supported settings.

The following does now work:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <!-- Playwright -->  
  <Playwright>
    <BrowserName>chromium</BrowserName>
    <ExpectTimeout>5000</ExpectTimeout>
    <LaunchOptions>
      <Headless>true</Headless>
      <Channel>msedge</Channel>
    </LaunchOptions>
  </Playwright>
  <!-- General run configuration -->
  <RunConfiguration>
    <EnvironmentVariables>
      <!-- For debugging selectors, it's recommend to set the following environment variable -->
      <DEBUG>pw:api</DEBUG>
    </EnvironmentVariables>
  </RunConfiguration>
</RunSettings>

Announcements

  • 🪦 This is the last release with macOS 10.15 support (deprecated as of 1.21).
  • ⚠️ Ubuntu 18 is now deprecated and will not be supported as of Dec 2022.

Browser Versions

  • Chromium 105.0.5195.19
  • Mozilla Firefox 103.0
  • WebKit 16.0

This version was also tested against the following stable channels:

  • Google Chrome 104
  • Microsoft Edge 104

v1.24.1

28 Jul 21:17
8f01164
Compare
Choose a tag to compare

Highlights

This patch includes the following bug fixes:

#2231 - [REGRESSION] HEADLESS env does not work anymore
#2232 - [BUG] - Install MS Edge fails

Browser Versions

  • Chromium 104.0.5112.48
  • Mozilla Firefox 102.0
  • WebKit 16.0

This version was also tested against the following stable channels:

  • Google Chrome 103
  • Microsoft Edge 103

v1.24.0

22 Jul 08:33
Compare
Choose a tag to compare

Highlights

🐂 Debian 11 Bullseye Support

Playwright now supports Debian 11 Bullseye on x86_64 for Chromium, Firefox and WebKit. Let us know
if you encounter any issues!

Linux support looks like this:

Ubuntu 18.04 Ubuntu 20.04 Ubuntu 22.04 Debian 11
Chromium
WebKit
Firefox

📖 New Introduction Docs

We rewrote our Getting Started docs to be more end-to-end testing focused. Check them out on playwright.dev.

Browser Versions

  • Chromium 104.0.5112.48
  • Mozilla Firefox 102.0
  • WebKit 16.0

This version was also tested against the following stable channels:

  • Google Chrome 103
  • Microsoft Edge 103

v1.23.0

01 Jul 13:07
473c070
Compare
Choose a tag to compare

Highlights

API Testing

Playwright for .NET 1.23 introduces new API Testing that lets you send requests to the server directly from .NET!
Now you can:

  • test your server API
  • prepare server side state before visiting the web application in a test
  • validate server side post-conditions after running some actions in the browser

To do a request on behalf of Playwright's Page, use new Page.APIRequest API:

// Do a GET request on behalf of page
var response = await Page.APIRequest.GetAsync("http://example.com/foo.json");
Console.WriteLine(response.Status);
Console.WriteLine(response.StatusText);
Console.WriteLine(response.Ok);
Console.WriteLine(response.Headers["Content-Type"]);
Console.WriteLine(await response.TextAsync());
Console.WriteLine((await response.JsonAsync())?.GetProperty("foo").GetString());

Read more about it in our API testing guide.

Network Replay

Now you can record network traffic into a HAR file and re-use this traffic in your tests.

To record network into HAR file:

pwsh bin\Debug\netX\playwright.ps1 open --save-har=example.har --save-har-glob="**/api/**" https://example.com

Alternatively, you can record HAR programmatically:

var context = await browser.NewContextAsync(new ()
{
  RecordHarPath = harPath,
  RecordHarUrlFilterString = "**/api/**",
});

// ... Perform actions ...

// Close context to ensure HAR is saved to disk.
context.CloseAsync();

Use the new methods Page.RouteFromHARAsync or BrowserContext.RouteFromHARAsync to serve matching responses from the HAR file:

await context.RouteFromHARAsync("example.har");

Read more in our documentation.

Advanced Routing

You can now use Route.FallbackAsync to defer routing to other handlers.

Consider the following example:

// Remove a header from all requests.
await page.RouteAsync("**/*", async route =>
{
    var headers = route.Request.Headers;
    headers.Remove("X-Secret");
    await route.ContinueAsync(new () { Headers = headers });
});

// Abort all images.
await page.RouteAsync("**/*", async route =>
{
    if (route.Request.ResourceType == "image")
    {
        await route.AbortAsync();
    }
    else
    {
        await route.FallbackAsync();
    }
});

Note that the new methods Page.RouteFromHARAsync and BrowserContext.RouteFromHARAsync also participate in routing and could be deferred to.

Web-First Assertions Update

Miscellaneous

  • If there's a service worker that's in your way, you can now easily disable it with a new context option ServiceWorkers:
    var context = await Browser.NewContextAsync(new()
    {
        ServiceWorkers = ServiceWorkerPolicy.Block
    });
  • Using .zip path for recordHar context option automatically zips the resulting HAR:
    var context = await Browser.NewContextAsync(new() { RecordHarPath = "example.har.zip" });
  • If you intend to edit HAR by hand, consider using the "minimal" HAR recording mode
    that only records information that is essential for replaying:
    var context = await Browser.NewContextAsync(new() { RecordHarPath = "example.har", RecordHarMode = HarMode.Minimal });
  • Playwright now runs on Ubuntu 22 amd64 and Ubuntu 22 arm64.
  • Playwright for .NET now supports linux-arm64 and provides a arm64 Ubuntu 20.04 Docker image for it.

v1.22.0

13 May 16:09
7610aa5
Compare
Choose a tag to compare

Highlights

  • Role selectors that allow selecting elements by their ARIA role, ARIA attributes and accessible name.

    // Click a button with accessible name "log in"
    await page.ClickAsync("role=button[name='log in']")

    Read more in our documentation.

  • New Locator.Filter API to filter an existing locator

    var buttons = page.Locator("role=button");
    // ...
    var submitLocator = buttons.Filter(new LocatorFilterOptions { HasText = "Sign up" });
    await submitLocator.ClickAsync();

v1.21.0

13 Apr 20:22
05539d4
Compare
Choose a tag to compare

Highlights

  • New experimental role selectors that allow selecting elements by their ARIA role, ARIA attributes and accessible name.

    // Click a button with accessible name "log in"
    await page.ClickAsync("role=button[name='log in']")

    To use role selectors, make sure to pass PLAYWRIGHT_EXPERIMENTAL_FEATURES=1 environment variable.

    Read more in our documentation.

  • New scale option in Page.ScreenshotAsync for smaller sized screenshots.

  • New caret option in Page.ScreenshotAsync to control text caret. Defaults to "hide".

  • We now ship a designated .NET docker image mcr.microsoft.com/playwright/dotnet. Read more in our documentation.

Behavior Changes

Browser Versions

  • Chromium 101.0.4951.26
  • Mozilla Firefox 98.0.2
  • WebKit 15.4

This version was also tested against the following stable channels:

  • Google Chrome 100
  • Microsoft Edge 100

v1.20.2

23 Mar 22:02
5549ebd
Compare
Choose a tag to compare

Highlights

This patch includes the following bug fixes:

microsoft/playwright#12711 - [REGRESSION] Page.screenshot hangs on some sites
microsoft/playwright#12807 - [BUG] Cookies get assigned before fulfilling a response
microsoft/playwright#12821 - [BUG] Chromium: Cannot click, element intercepts pointer events
microsoft/playwright#12887 - [BUG] Locator.count() with _vue selector with Repro
microsoft/playwright#12974 - [BUG] Regression - chromium browser closes during test or debugging session on macos
#2074 - [BUG] NullReferenceException in Connection.WrapApiCallAsync
#2069 - [BUG] dotnet build did not override files

Browser Versions

  • Chromium 101.0.4921.0
  • Mozilla Firefox 97.0.1
  • WebKit 15.4

This version was also tested against the following stable channels:

  • Google Chrome 99
  • Microsoft Edge 99

v1.20.1

16 Mar 09:53
Compare
Choose a tag to compare

Highlights

This patch includes bug fixes for the following issues:

#2067 - [BUG] Running Playwright without a namespace lead to a null pointer exception

Browser Versions

  • Chromium 101.0.4921.0
  • Mozilla Firefox 97.0.1
  • WebKit 15.4

This version was also tested against the following stable channels:

  • Google Chrome 99
  • Microsoft Edge 99

v1.20.0

15 Mar 23:26
6332e25
Compare
Choose a tag to compare

Web-First Assertions

Playwright for .NET 1.20 introduces Web-First Assertions.

Consider the following example:

using System.Threading.Tasks;
using Microsoft.Playwright.NUnit;
using NUnit.Framework;

namespace Playwright.TestingHarnessTest.NUnit
{
    public class ExampleTests : PageTest
    {
        [Test]
        public async Task StatusBecomesSubmitted()
        {
            await Expect(Page.Locator(".status")).ToHaveTextAsync("Submitted");
        }
    }
}

Playwright will be re-testing the node with the selector .status until
fetched Node has the "Submitted" text. It will be re-fetching the node and
checking it over and over, until the condition is met or until the timeout is
reached. You can pass this timeout as an option.

Read more in our documentation.

Other Updates

Announcements

  • v1.20 is the last release to receive WebKit update for macOS 10.15 Catalina. Please update MacOS to keep using latest & greatest WebKit!

Browser Versions

  • Chromium 101.0.4921.0
  • Mozilla Firefox 97.0.1
  • WebKit 15.4

This version was also tested against the following stable channels:

  • Google Chrome 99
  • Microsoft Edge 99