diff --git a/packages/playwright-core/src/server/firefox/ffAccessibility.ts b/packages/playwright-core/src/server/firefox/ffAccessibility.ts index 9bf519c3bb..d8d56b58de 100644 --- a/packages/playwright-core/src/server/firefox/ffAccessibility.ts +++ b/packages/playwright-core/src/server/firefox/ffAccessibility.ts @@ -245,7 +245,6 @@ class FFAXNode implements accessibility.AXNode { const tokenProperties: Array = [ 'autocomplete', 'haspopup', - 'invalid', 'orientation', ]; for (const tokenProperty of tokenProperties) { @@ -261,6 +260,8 @@ class FFAXNode implements accessibility.AXNode { axNode.checked = this._payload.checked === true ? 'checked' : this._payload.checked === 'mixed' ? 'mixed' : 'unchecked'; if ('pressed' in this._payload) axNode.pressed = this._payload.pressed === true ? 'pressed' : 'released'; + if ('invalid' in this._payload) + axNode.invalid = this._payload.invalid === true ? 'true' : 'false'; return axNode; } } diff --git a/tests/page/page-accessibility.spec.ts b/tests/page/page-accessibility.spec.ts index 496819ce95..e6717c5e20 100644 --- a/tests/page/page-accessibility.spec.ts +++ b/tests/page/page-accessibility.spec.ts @@ -348,3 +348,20 @@ it('should work when there is a title ', async ({ page }) => { expect(snapshot.name).toBe('This is the title'); expect(snapshot.children[0].name).toBe('This is the content'); }); + +it('should work with aria-invalid accessibility tree', async ({ page, browserName, server }) => { + await page.goto(server.EMPTY_PAGE); + await page.setContent(`WHO WE ARE`); + expect(await page.accessibility.snapshot()).toEqual({ + 'role': browserName === 'firefox' ? 'document' : 'WebArea', + 'name': '', + 'children': [ + { + 'role': 'link', + 'name': 'WHO WE ARE', + 'invalid': 'true', + 'value': browserName === 'firefox' ? `${server.PREFIX}/hi` : undefined + } + ] + }); +});