Skip to content

v14.0.0

Compare
Choose a tag to compare
@kblok kblok released this 25 Jan 15:49
· 88 commits to master since this release
62f2091

Breaking changes

  • Hopefully, this is not a big deal. But IElementHandle.ScreenshotAsync(... ScreenshotOptions) was renamed to IElementHandle.ScreenshotAsync(... ElementScreenshotOptions) in #2376

What's New

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)
);

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