Skip to content

v25.19.0

Puppeteer Sharp 25.19.0 was released on November 30, 2026. Target frameworks are unchanged: netstandard2.0, net8.0, and net10.0.

Terminal window
dotnet add package PuppeteerSharp --version 25.19.0

The browsers downloaded by default are now Chrome 158.0.8127.88 and Firefox 161.0 (stable_161.0).

The public API tracks Puppeteer 25.19.0 and puppeteer-core 25.19.0.

Locator.Clone returns a new locator with the same options (#3839). SetTimeout, SetVisibility, SetWaitForEnabled, SetEnsureElementIsInTheViewport, and SetWaitForStableBoundingBox also return a clone. They no longer change the locator they are called on. Timeout is a public getter. The default remains 30_000 milliseconds. Filter, Map, and the handle variants copy those options onto the new locator.

var baseLocator = page.Locator("#submit").SetTimeout(5_000);
var noEnabledWait = baseLocator.SetWaitForEnabled(false);
// baseLocator.Timeout is still 5_000, and its wait-for-enabled setting is unchanged.
// baseLocator.Clone().Timeout and baseLocator.Map("el => el").Timeout are also 5_000.
await baseLocator.ClickAsync();
await noEnabledWait.ClickAsync();

Action event handlers are not copied. Attach Action to the locator instance that will run the action, after the setters.

Locator.Action is an EventHandler raised every time before the locator performs a click, hover, scroll, or fill (#3842). It fires after the viewport, stable-bounding-box, and enabled checks that still apply, and before the action itself.

await page.SetContentAsync("<button disabled>test</button>");
var willClick = false;
var locator = page.LocatorFunction("() => document.querySelector('button')")
.SetWaitForEnabled(false)
.SetTimeout(2_000);
locator.Action += (_, _) => willClick = true;
await locator.ClickAsync();

willClick is true once the click runs. Because SetWaitForEnabled(false) was set on the chained locator, the disabled button does not block the action.

ITarget.CloseAsync closes a target without creating a page for it (#3862). The API is experimental. It does not run beforeunload handlers. On CDP, concurrent calls on the same target share one operation, because a second Target.closeTarget fails if the target is already gone. A second call on an already closed target completes without throwing. A repeated WebDriver BiDi page close is swallowed and also completes without throwing.

CDP can close page, service-worker, and shared-worker targets. It throws for a browser target, the target of a frame, or a dedicated worker. WebDriver BiDi can close a page target (it closes the page). Other BiDi targets throw NotSupportedException, including the browser target, a frame target, and a worker target.

Chrome destroys a service worker only after every attached CDP session has detached. If another session, for example one from CreateCDPSessionAsync, stays attached, the returned task might not complete. There is no timeout. WebWorker.CloseAsync for a service worker or a shared worker now goes through the target and completes only once that target is gone.

var page = await context.NewPageAsync();
var popupTask = context.WaitForTargetAsync(t =>
t.Type == TargetType.Page && t.Opener != null);
await page.EvaluateFunctionAsync("() => window.open('about:blank')");
ITarget popup = await popupTask;
await popup.CloseAsync();

Opener is a CDP value. On WebDriver BiDi, ITarget.Opener throws (InvalidOperationException for a page target, PuppeteerException with the message Not supported for the browser, a frame, and a worker). Match the popup by Url on BiDi, then call CloseAsync the same way.

On CDP, open a page you control that registers a service worker, then wait for the target whose Url is that script. Call WorkerAsync so Puppeteer attaches, then close the target. A type-only match can return another service worker already in the context. https://example.com does not register one, so the wait would time out. A WebDriver BiDi worker target throws, as described above:

await page.GoToAsync(serviceWorkerPageUrl);
ITarget target = await context.WaitForTargetAsync(t =>
t.Type == TargetType.ServiceWorker && t.Url == serviceWorkerScriptUrl);
await target.WorkerAsync();
await target.CloseAsync();

ITarget has a new member, so a type outside the library that implements the interface must add CloseAsync. On WebDriver BiDi, IPage.Target (already obsolete) throws PuppeteerException with the message Target not found for page when the page is closed, instead of returning null.

BrowserFetcher retries transient download failures

Section titled “BrowserFetcher retries transient download failures”

BrowserFetcherOptions.Retry retries the browser archive download when the failure is transient (#3852). The default is 0. A negative value throws ArgumentOutOfRangeException ("Invalid retry value: must be a non-negative integer"). Retries apply to HTTP 408, 429, and 5xx responses, and to network errors, with exponential backoff from 1 second, capped at 10 seconds. The option applies only to the default downloader. It is ignored when CustomFileDownload is set.

var fetcher = new BrowserFetcher(new BrowserFetcherOptions
{
Retry = 3,
});
await fetcher.DownloadAsync();

The PuppeteerSharp.Browsers tool accepts the same value as --retry:

Terminal window
puppeteer-browsers install chrome --retry 3

A download attempt also fails as transient if the response body stalls for 30 seconds (#3854). Redirects stop after 20 hops (#3894).

WebDriver BiDi ReloadAsync waits for the new document when a beforeunload handler calls the history API (#3800). WaitForNavigationAsync no longer completes on HistoryUpdated when IgnoreSameDocumentNavigation is set, which ReloadAsync already sets. BiDi network-idle waits use the default navigation timeout (#3812).

Headful browsers on Windows are no longer launched with a hidden window (#3836). CreateNoWindow is set only when the browser is headless.

GoBackAsync and GoForwardAsync no longer return a null response when a history navigation swaps the frame before the response arrives (#3844). Only activation-style swaps, such as prerender activation or a back/forward cache restore, resolve the response early. A cancelled GoBackAsync or GoForwardAsync no longer waits for the history command to finish.

SetViewportAsync stores a copy of the ViewPortOptions it receives, and Viewport returns a copy (#3848). Later changes to the caller’s object, a shared device descriptor, or the object returned by Viewport do not change the page.

EvaluateFunctionOnNewDocumentAsync preserves -0, NaN, Infinity, -Infinity, and BigInteger arguments, writing them as JavaScript literals instead of JSON (#3858).

Accessibility.SnapshotAsync keeps iframe content when IncludeIframes and Root are both set (#3860). Child frames no longer inherit the parent Root. The method returns null early when that root node is not found, and only iframes inside the root subtree are visited.

LaunchAsync and ConnectAsync throw NotSupportedException ("targetFilter is not supported with the WebDriver BiDi protocol") when TargetFilter is set and the protocol is WebDriver BiDi (#3863).

Page screenshots are serialized across browser contexts, so a screenshot in one context no longer races with NewPageAsync or CloseAsync in another (#3892).

Other fixes:

  • Old Windows Chromium builds (revision ≤ 591479) resolve their executable under chrome-win32 instead of chrome-win (#3817)
  • A target becomes the primary page only when it is a page and its subtype has been cleared (#3832)
  • Concurrent manual CDP attaches are counted per target (#3856)
  • CDP reports the numpad location on keyup (#3866)
  • Emulating media features keeps the current media type (#3864)
  • GetPropertiesAsync works on primitive handles: a number returns no properties, and a string returns one handle per character. A disposed handle throws PuppeteerException (Attempted to use disposed plus the handle type) (#3876)
  • Navigation ends immediately when the page crashes (#3878)
  • WaitForFileChooserAsync and device-prompt waits honor an already cancelled token (#3879)
  • Unrecognized HTTP status codes use "Unknown" as the reason phrase (#3885)
  • Selector and function waits keep the caller’s CancellationToken when they are cancelled (#3886)
  • Tracing resets after a failure, stops hanging on disconnect, and closes the trace file before StopAsync returns (#3890, #3900)
  • WebDriver BiDi updates the mouse position after a click (#3891)
  • BiDi rejects an exposed function call whose result cannot be serialized (#3898)
  • The mouse state stays accurate when a command fails (#3899)
  • Coverage waits for pending script sources (#3901)
  • A BiDi connection close is propagated to the browser (#3865)

SetTimeout, SetVisibility, SetWaitForEnabled, SetEnsureElementIsInTheViewport, and SetWaitForStableBoundingBox return a clone and leave the original locator unchanged (#3839). Code that called a setter and then reused the same instance for the new option needs to use the returned locator.

ITarget has a new CloseAsync member (#3862). External implementations must add it. WebWorker.CloseAsync for a service or shared worker completes only after the target is gone. On WebDriver BiDi, IPage.Target throws PuppeteerException for a closed page instead of returning null.

TargetFilter with WebDriver BiDi throws NotSupportedException on launch and on connect (#3863).

SetViewportAsync and Viewport copy the ViewPortOptions object (#3848). Mutating the caller’s object or the object returned by Viewport no longer changes the page.

Made with love by Dario Kondratiuk