v1.41.0
microsoft/playwrightv1.41.0Jan 16, 2024by mxschmitt
AI Summary
Added methods to remove all registered routes and options to apply custom CSS to screenshots. Improved Blob reporter functionality.
Key Highlights
- New unrouteAll methods for Page and BrowserContext
- Custom CSS options for screenshots (style and stylePath)
- New fileName option for Blob reporter
New Features
- page.unrouteAll() and browserContext.unrouteAll()
- Screenshot style and stylePath options
- Blob reporter fileName option
Full Release Notes
## New APIs - New method [page.unrouteAll([options])](https://playwright.dev/docs/api/class-page#page-unroute-all) removes all routes registered by [page.route(url, handler, handler[, options])](https://playwright.dev/docs/api/class-page#page-route) and [page.routeFromHAR(har[, options])](https://playwright.dev/docs/api/class-page#page-route-from-har). Optionally allows to wait for ongoing routes to finish, or ignore any errors from them. - New method [browserContext.unrouteAll([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-unroute-all) removes all routes registered by [browserContext.route(url, handler, handler[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route) and [browserContext.routeFromHAR(har[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-route-from-har). Optionally allows to wait for ongoing routes to finish, or ignore any errors from them. - New option `style` in [page.screenshot([options])](https://playwright.dev/docs/api/class-page#page-screenshot) and [locator.screenshot([options])](https://playwright.dev/docs/api/class-locator#locator-screenshot) to add custom CSS to the page before taking a screenshot. - New option `stylePath` for methods [expect(page).toHaveScreenshot(name[, options])](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1) and [expect(locator).toHaveScreenshot(name[, options])](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-1) to apply a custom stylesheet while making the screenshot. - New `fileName` option for [Blob reporter](https://playwright.dev/docs/test-reporters#blob-reporter), to specify the name of the report to be created. ## Browser Versions * Chromium 121.0.6167.57 * Mozilla Firefox 121.0 * WebKit 17.4 This version was also tested against the following stable channels: * Google Chrome 120 * Microsoft Edge 120