Zum Inhalt springen
verdict:

Playwright 1.59.0

featured

note: die Zusammenfassung und die Release Notes sind auf Englisch

note: keine Zusammenfassung für dieses ältere Release

Wir fassen die neueren Releases zusammen. Die originalen Release Notes dieser Version stehen hier unten.

release-notesgithub.com/microsoft/playwright · 271 Zeilen
  1. ## 🎬 Screencast
  2. New [page.screencast](https://playwright.dev/docs/api/class-page#page-screencast) API provides a unified interface for capturing page content with:
  3. - Screencast recordings
  4. - Action annotations
  5. - Visual overlays
  6. - Real-time frame capture
  7. - Agentic video receipts
  8. <center>
  9. <img src="https://raw.githubusercontent.com/microsoft/playwright/main/docs/src/images/release-notes-1.59-screencast-demo.gif" alt="Demo" width="500" height="313" />
  10. </center>
  11. **Screencast recording** — record video with precise start/stop control, as an alternative to the [`recordVideo`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-video) option:
  12. ```js
  13. await page.screencast.start({ path: 'video.webm' });
  14. // ... perform actions ...
  15. await page.screencast.stop();
  16. ```
  17. **Action annotations** — enable built-in visual annotations that highlight interacted elements and display action titles during recording:
  18. ```js
  19. await page.screencast.showActions({ position: 'top-right' });
  20. ```
  21. [screencast.showActions()](https://playwright.dev/docs/api/class-screencast#screencast-show-actions) accepts `position` (`'top-left'`, `'top'`, `'top-right'`, `'bottom-left'`, `'bottom'`, `'bottom-right'`), `duration` (ms per annotation), and `fontSize` (px). Returns a disposable to stop showing actions.
  22. Action annotations can also be enabled in test fixtures via the `video` option:
  23. ```js
  24. // playwright.config.ts
  25. export default defineConfig({
  26. use: {
  27. video: {
  28. mode: 'on',
  29. show: {
  30. actions: { position: 'top-left' },
  31. test: { position: 'top-right' },
  32. },
  33. },
  34. },
  35. });
  36. ```
  37. **Visual overlays** — add chapter titles and custom HTML overlays on top of the page for richer narration:
  38. ```js
  39. await page.screencast.showChapter('Adding TODOs', {
  40. description: 'Type and press enter for each TODO',
  41. duration: 1000,
  42. });
  43. await page.screencast.showOverlay('<div style="color: red">Recording</div>');
  44. ```
  45. **Real-time frame capture** — stream JPEG-encoded frames for custom processing like thumbnails, live previews, AI vision, and more:
  46. ```js
  47. await page.screencast.start({
  48. onFrame: ({ data }) => sendToVisionModel(data),
  49. size: { width: 800, height: 600 },
  50. });
  51. ```
  52. **Agentic video receipts** — coding agents can produce video evidence of their work. After completing a task, an agent can record a walkthrough video with rich annotations for human review:
  53. ```js
  54. await page.screencast.start({ path: 'receipt.webm' });
  55. await page.screencast.showActions({ position: 'top-right' });
  56. await page.screencast.showChapter('Verifying checkout flow', {
  57. description: 'Added coupon code support per ticket #1234',
  58. });
  59. // Agent performs the verification steps...
  60. await page.locator('#coupon').fill('SAVE20');
  61. await page.locator('#apply-coupon').click();
  62. await expect(page.locator('.discount')).toContainText('20%');
  63. await page.screencast.showChapter('Done', {
  64. description: 'Coupon applied, discount reflected in total',
  65. });
  66. await page.screencast.stop();
  67. ```
  68. The resulting video serves as a receipt: chapter titles provide context, action annotations highlight each interaction, and the visual walkthrough is faster to review than text logs.
  69. ## 🔗 Interoperability
  70. New [browser.bind()](https://playwright.dev/docs/api/class-browser#browser-bind) API makes a launched browser available for `playwright-cli`, `@playwright/mcp`, and other clients to connect to.
  71. **Bind a browser** — start a browser and bind it so others can connect:
  72. ```js
  73. const { endpoint } = await browser.bind('my-session', {
  74. workspaceDir: '/my/project',
  75. });
  76. ```
  77. **Connect from playwright-cli** — connect to the running browser from your favorite coding agent.
  78. ```bash
  79. playwright-cli attach my-session
  80. playwright-cli -s my-session snapshot
  81. ```
  82. **Connect from @playwright/mcp** — or point your MCP server to the running browser.
  83. ```bash
  84. @playwright/mcp --endpoint=my-session
  85. ```
  86. **Connect from a Playwright client** — use API to connect to the browser. Multiple clients at a time are supported!
  87. ```js
  88. const browser = await chromium.connect(endpoint);
  89. ```
  90. Pass `host` and `port` options to bind over WebSocket instead of a named pipe:
  91. ```js
  92. const { endpoint } = await browser.bind('my-session', {
  93. host: 'localhost',
  94. port: 0,
  95. });
  96. // endpoint is a ws:// URL
  97. ```
  98. Call [browser.unbind()](https://playwright.dev/docs/api/class-browser#browser-unbind) to stop accepting new connections.
  99. ## 📊 Observability
  100. Run `playwright-cli show` to open the Dashboard that lists all the bound browsers, their statuses, and allows interacting with them:
  101. - See what your agent is doing on the background browsers
  102. - Click into the sessions for manual interventions
  103. - Open DevTools to inspect pages from the background browsers.
  104. <center>
  105. <img src="https://raw.githubusercontent.com/microsoft/playwright/main/docs/src/images/release-notes-1.59-dashboard.png" alt="Demo" width="1169" height="835" />
  106. </center>
  107. - `playwright-cli` binds all of its browsers automatically, so you can see what your agents are doing.
  108. - Pass `PLAYWRIGHT_DASHBOARD=1` env variable to see all `@playwright/test` browsers in the dashboard.
  109. ## 🐛 CLI debugger for agents
  110. Coding agents can now run `npx playwright test --debug=cli` to attach and debug tests over `playwright-cli` — perfect for automatically fixing tests in agentic workflows:
  111. ```bash
  112. $ npx playwright test --debug=cli
  113. ### Debugging Instructions
  114. - Run "playwright-cli attach tw-87b59e" to attach to this test
  115. $ playwright-cli attach tw-87b59e
  116. ### Session `tw-87b59e` created, attached to `tw-87b59e`.
  117. Run commands with: playwright-cli --session=tw-87b59e <command>
  118. ### Paused
  119. - Navigate to "/" at output/tests/example.spec.ts:4
  120. $ playwright-cli --session tw-87b59e step-over
  121. ### Page
  122. - Page URL: https://playwright.dev/
  123. - Page Title: Fast and reliable end-to-end testing for modern web apps | Playwright
  124. ### Paused
  125. - Expect "toHaveTitle" at output/tests/example.spec.ts:7
  126. ```
  127. ## 📋 CLI trace analysis for agents
  128. Coding agents can run `npx playwright trace` to explore [Playwright Trace](https://playwright.dev/docs/trace-viewer) and understand failing or flaky tests from the command line:
  129. ```bash
  130. $ npx playwright trace open test-results/example-has-title-chromium/trace.zip
  131. Title: example.spec.ts:3 › has title
  132. $ npx playwright trace actions --grep="expect"
  133. # Time Action Duration
  134. ──── ───────── ─────────────────────────────────────────────────────── ────────
  135. 9. 0:00.859 Expect "toHaveTitle" 5.1s ✗
  136. $ npx playwright trace action 9
  137. Expect "toHaveTitle"
  138. Error: expect(page).toHaveTitle(expected) failed
  139. Expected pattern: /Wrong Title/
  140. Received string: "Fast and reliable end-to-end testing for modern web apps | Playwright"
  141. Timeout: 5000ms
  142. Snapshots
  143. available: before, after
  144. usage: npx playwright trace snapshot 9 --name <before|after>
  145. $ npx playwright trace snapshot 9 --name after
  146. ### Page
  147. - Page Title: Fast and reliable end-to-end testing for modern web apps | Playwright
  148. $ npx playwright trace close
  149. ```
  150. ## ♻️ `await using`
  151. Many APIs now return [async disposables](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncDispose), enabling the `await using` syntax for automatic cleanup:
  152. ```js
  153. await using page = await context.newPage();
  154. {
  155. await using route = await page.route('**/*', route => route.continue());
  156. await using script = await page.addInitScript('console.log("init script here")');
  157. await page.goto('https://playwright.dev');
  158. // do something
  159. }
  160. // route and init script have been removed at this point
  161. ```
  162. ## 🔍 Snapshots and Locators
  163. - Method [page.ariaSnapshot()](https://playwright.dev/docs/api/class-page#page-aria-snapshot) to capture the aria snapshot of the page — equivalent to `page.locator('body').ariaSnapshot()`.
  164. - Options `depth` and `mode` in [locator.ariaSnapshot()](https://playwright.dev/docs/api/class-locator#locator-aria-snapshot).
  165. - Method [locator.normalize()](https://playwright.dev/docs/api/class-locator#locator-normalize) converts a locator to follow best practices like test ids and aria roles.
  166. - Method [page.pickLocator()](https://playwright.dev/docs/api/class-page#page-pick-locator) enters an interactive mode where hovering over elements highlights them and shows the corresponding locator. Click an element to get its [Locator](https://playwright.dev/docs/api/class-locator) back. Use [page.cancelPickLocator()](https://playwright.dev/docs/api/class-page#page-cancel-pick-locator) to cancel.
  167. ## New APIs
  168. ### Screencast
  169. - [page.screencast](https://playwright.dev/docs/api/class-page#page-screencast) provides video recording, real-time frame streaming, and overlay management.
  170. - Methods [screencast.start()](https://playwright.dev/docs/api/class-screencast#screencast-start) and [screencast.stop()](https://playwright.dev/docs/api/class-screencast#screencast-stop) for recording and frame capture.
  171. - Methods [screencast.showActions()](https://playwright.dev/docs/api/class-screencast#screencast-show-actions) and [screencast.hideActions()](https://playwright.dev/docs/api/class-screencast#screencast-hide-actions) for action annotations.
  172. - Methods [screencast.showChapter()](https://playwright.dev/docs/api/class-screencast#screencast-show-chapter) and [screencast.showOverlay()](https://playwright.dev/docs/api/class-screencast#screencast-show-overlay) for visual overlays.
  173. - Methods [screencast.showOverlays()](https://playwright.dev/docs/api/class-screencast#screencast-show-overlays) and [screencast.hideOverlays()](https://playwright.dev/docs/api/class-screencast#screencast-hide-overlays) for overlay visibility control.
  174. ### Storage, Console and Errors
  175. - Method [browserContext.setStorageState()](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-storage-state) clears existing cookies, local storage, and IndexedDB for all origins and sets a new storage state — no need to create a new context.
  176. - Methods [page.clearConsoleMessages()](https://playwright.dev/docs/api/class-page#page-clear-console-messages) and [page.clearPageErrors()](https://playwright.dev/docs/api/class-page#page-clear-page-errors) to clear stored messages and errors.
  177. - Option `filter` in [page.consoleMessages()](https://playwright.dev/docs/api/class-page#page-console-messages) and [page.pageErrors()](https://playwright.dev/docs/api/class-page#page-page-errors) controls which messages are returned.
  178. - Method [consoleMessage.timestamp()](https://playwright.dev/docs/api/class-consolemessage#console-message-timestamp).
  179. ### Miscellaneous
  180. - [browserContext.debugger](https://playwright.dev/docs/api/class-browsercontext#browser-context-debugger) provides programmatic control over the Playwright debugger.
  181. - Method [browserContext.isClosed()](https://playwright.dev/docs/api/class-browsercontext#browser-context-is-closed).
  182. - Method [request.existingResponse()](https://playwright.dev/docs/api/class-request#request-existing-response) returns the response without waiting.
  183. - Method [response.httpVersion()](https://playwright.dev/docs/api/class-response#response-http-version) returns the HTTP version used by the response.
  184. - Events [cdpSession.on('event')](https://playwright.dev/docs/api/class-cdpsession#cdp-session-event-event) and [cdpSession.on('close')](https://playwright.dev/docs/api/class-cdpsession#cdp-session-event-close) for CDP sessions.
  185. - Option `live` in [tracing.start()](https://playwright.dev/docs/api/class-tracing#tracing-start) for real-time trace updates.
  186. - Option `artifactsDir` in [browserType.launch()](https://playwright.dev/docs/api/class-browsertype#browser-type-launch) to configure the artifacts directory.
  187. ## 🛠️ Other improvements
  188. - UI Mode has an option to only show tests affected by source changes.
  189. - UI Mode and Trace Viewer have improved action filtering.
  190. - HTML Reporter shows the list of runs from the same worker.
  191. - HTML Reporter allows filtering test steps for quick search.
  192. - New trace mode `'retain-on-failure-and-retries'` records a trace for each test run and retains all traces when an attempt fails — great for comparing a passing trace with a failing one from a flaky test.
  193. ## Known Issues ⚠️⚠️
  194. - `navigator.platform` emulation can cause Ctrl or Meta dispatching errors (https://github.com/microsoft/playwright/issues/40009). Pass `PLAYWRIGHT_NO_UA_PLATFORM = '1'` environment variable while we are issuing a patch release. Let us know in the issue how it affected you.
  195. ## Breaking Changes ⚠️
  196. - Removed macOS 14 support for WebKit. We recommend upgrading your macOS version, or keeping an older Playwright version.
  197. - Removed `@playwright/experimental-ct-svelte` package.
  198. - `junit` test reporter now differentiates between types of errors, so some of the previous `<failure>`s are now reported as `<error>`s.
  199. ## Browser Versions
  200. - Chromium 147.0.7727.15
  201. - Mozilla Firefox 148.0.2
  202. - WebKit 26.4
  203. This version was also tested against the following stable channels:
  204. - Google Chrome 146
  205. - Microsoft Edge 146

auf github ansehenimported 2026-09-28 über npm