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
fix(aria): do not hang ai snapshot on frameset pages (#41816)
Dmitry Gozman43e262f70702
diff --git a/packages/playwright-core/src/server/page.ts b/packages/playwright-core/src/server/page.tsindex e2b72ef2fc..8cde5b8ae6 100644--- a/packages/playwright-core/src/server/page.ts+++ b/packages/playwright-core/src/server/page.ts@@ -1116,7 +1116,9 @@ export async function ariaSnapshotForFrame(progress: Progress, frame: frames.Fraconst snapshot = await frame.retryWithProgressAndTimeouts(progress, [1000, 2000, 4000, 8000], async (progress, continuePolling) => {try {// Note: the resolved frame might differ from the original |frame|.- const resolved = await progress.race(frame.selectors.callOnSelector(selector || 'body', { strict: true }, ({ injected, elements }, ariaOptions) => {+ // See https://developer.mozilla.org/en-US/docs/Web/API/Document/body for body/frameset explanation.+ // Non-strict, because pages with nested framesets have multiple "frameset" elements.+ const resolved = await progress.race(frame.selectors.callOnSelector(selector || 'body,frameset', { strict: !!selector }, ({ injected, elements }, ariaOptions) => {return injected.ariaSnapshotWithRefs(elements[0], ariaOptions);}, {mode: options.mode ?? 'default',diff --git a/tests/page/page-aria-snapshot-ai.spec.ts b/tests/page/page-aria-snapshot-ai.spec.tsindex 99abe6743a..4780ff1211 100644--- a/tests/page/page-aria-snapshot-ai.spec.ts+++ b/tests/page/page-aria-snapshot-ai.spec.ts@@ -668,6 +668,12 @@ it('should support many properties on iframes', async ({ page }) => {`);});+it('should not timeout on frameset pages', { annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/41784' } }, async ({ page, server }) => {+ await page.goto(server.PREFIX + '/frames/frameset.html');+ const snapshot = await snapshotForAI(page, { timeout: 3000 });+ expect(snapshot).toBe('');+});+it('should collapse inline generic nodes', async ({ page }) => {await page.setContent(`<ul>