Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: use `_snapshotForAI` in page snapshot (#36745)
Simon Knottd0c3cffd7a59
diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.tsindex e2220395fa..146e6acb66 100644--- a/packages/playwright/src/index.ts+++ b/packages/playwright/src/index.ts@@ -31,6 +31,7 @@ import type { ClientInstrumentationListener } from '../../playwright-core/src/climport type { Playwright as PlaywrightImpl } from '../../playwright-core/src/client/playwright';import type { Browser as BrowserImpl } from '../../playwright-core/src/client/browser';import type { BrowserContext as BrowserContextImpl } from '../../playwright-core/src/client/browserContext';+import type { Page as PageImpl } from '../../playwright-core/src/client/page';import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions, LaunchOptions, Page, Tracing, Video } from 'playwright-core';export { expect } from './matchers/expect';@@ -664,10 +665,12 @@ class ArtifactsRecorder {if (this._pageSnapshot)return;const page = context.pages()[0];+ if (!page)+ return;try {// TODO: maybe capture snapshot when the error is created, so it's from the right page and right time- this._pageSnapshot = await page?.locator('body').ariaSnapshot({ timeout: 5000 });+ this._pageSnapshot = await (page as PageImpl)._snapshotForAI({ timeout: 5000 });} catch {}}