Releases: microsoft/playwright-dotnet
v1.24.1
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
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
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
- New method
LocatorAssertions.ToHaveValuesAsync
that asserts all selected values of<select multiple>
element. - Methods
LocatorAssertions.ToContainTextAsync
andLocatorAssertions.ToHaveTextAsync
now acceptIgnoreCase
option.
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 forrecordHar
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
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 locatorvar buttons = page.Locator("role=button"); // ... var submitLocator = buttons.Filter(new LocatorFilterOptions { HasText = "Sign up" }); await submitLocator.ClickAsync();
v1.21.0
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 inPage.ScreenshotAsync
for smaller sized screenshots. -
New
caret
option inPage.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
- Playwright now supports large file uploads (100s of MBs) via
Locator.SetInputFilesAsync
API.
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
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
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
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
- New options for methods
page.screenshot()
,locator.screenshot()
andelementHandle.screenshot()
:- Option
ScreenshotAnimations.Disabled
rewinds all CSS animations and transitions to a consistent state - Option
mask: Locator[]
masks given elements, overlaying them with pink#FF00FF
boxes.
- Option
Locator.highlight()
visually reveals element(s) for easier debugging.
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
v1.19.1
Highlights
This patch includes the following bug fixes:
#2023 - [BUG] chore: don't include PlaywrightCopyItems in pack
microsoft/playwright#12075 - [Question] After update to 1.19 firefox fails to run
microsoft/playwright#12106 - [BUG] Error: EBUSY: resource busy or locked when using volumes in docker-compose with playwright 1.19.0 and mcr.microsoft.com/playwright:v1.15.0-focal
Browser Versions
- Chromium 100.0.4863.0
- Mozilla Firefox 96.0.1
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 98
- Microsoft Edge 98
v1.19.0
Version 1.19
Locator Updates
Locator now supports a has
option that makes sure it contains another locator inside:
await Page.Locator("article", new () { Has = Page.Locator(".highlight") }).ClickAsync();
The snippet above will select article that has highlight in it and will press the button in it.
Read more in locator documentation
Other Updates
- New
method: Locator.page
method: Page.screenshot
andmethod: Locator.screenshot
now automatically hides blinking caret- Playwright Codegen now generates locators and frame locators
Browser Versions
- Chromium 100.0.4863.0
- Mozilla Firefox 96.0.1
- WebKit 15.4
This version was also tested against the following stable channels:
- Google Chrome 98
- Microsoft Edge 98