v14.0.0
Breaking changes
- Hopefully, this is not a big deal. But
IElementHandle.ScreenshotAsync(... ScreenshotOptions)
was renamed toIElementHandle.ScreenshotAsync(... ElementScreenshotOptions)
in #2376
What's New
- Update chrome to 121.0.6167.85 by @kblok in #2411
- Introduce Wait for device prompt by @kblok in #2392
You can now wait for a device prompt!
var promptTask = Page.WaitForDevicePromptAsync();
await Task.WhenAll(
promptTask,
Page.ClickAsync("#connect-bluetooth"));
var devicePrompt = await promptTask;
await devicePrompt.SelectAsync(
await devicePrompt.WaitForDeviceAsync(device => device.Name.Contains("My Device")).ConfigureAwait(false)
);
- Support fetching request POST data by @kblok in #2402
- Cooperative request intercepts by @kblok in #2403
Now you can use AddRequestInterceptor
instead of the Request
page and give the ContinueAsync
, AbortAsync
and RespondAsync
different priorities.
Page.AddRequestInterceptor(request =>
{
if (request.Url.EndsWith(".css"))
{
var headers = request.Headers;
headers["xaction"] = "continue";
return request.ContinueAsync(new Payload() { Headers = headers, }, 4);
}
return request.ContinueAsync(new Payload(), 0);
});
Page.AddRequestInterceptor(request =>
{
if (request.Url.EndsWith(".css"))
{
Dictionary<string, object> headers = [];
foreach (var kvp in request.Headers)
{
headers.Add(kvp.Key, kvp.Value);
}
headers["xaction"] = "respond";
return request.RespondAsync(new ResponseData() { Headers = headers, }, 2);
}
return request.ContinueAsync(new Payload(), 0);
});
AddRequestInterceptor
will ensure that these new async listeners are executed one after the other.
Full Changelog: v13.0.2...v14.0.0