We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Locator
Test file (self-contained)
const { chromium, test, expect } = require( '@playwright/test' ); test( 'image locator', async () => { const browser = await chromium.launch(); const context = await browser.newContext(); const page = await context.newPage(); await page.setContent( ` <div data-testid="images"> <img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /> <svg class="components-spinner aecf-ce-a-fe-acea-1yxc2ud ea4tfvq2" viewBox="0 0 100 100" width="16" height="16" xmlns="http://www.w3.org/2000/svg" role="presentation" focusable="false"><circle cx="50" cy="50" r="50" vector-effect="non-scaling-stroke" class="aecf-ce-a-fe-acea-5zbsse ea4tfvq1"></circle><path d="m 50 0 a 50 50 0 0 1 50 50" vector-effect="non-scaling-stroke" class="aecf-ce-a-fe-acea-1r60s1s ea4tfvq0"></path></svg> </div> ` ); const image = page.getByTestId( 'images' ).getByRole( 'img' ); await expect( image ).toHaveAttribute( 'alt', 'Code is Poetry.' ); } );
Steps
Error: strict mode violation: getByTestId('images').getByRole('img') resolved to 2 elements
Expected
The test should only locate elements with role images.
Actual
The test incorrectly includes SVG in the located elements list.
This was working in Playwright v1.32.x.
The text was updated successfully, but these errors were encountered:
I am facing the same issue , did we deploy any fix for this ? PW version 1.41.1
Sorry, something went wrong.
fix(role): align presentation role conflict resolution with the spec (#…
103ec90
…30408) See https://www.w3.org/TR/wai-aria-1.2/#conflict_resolution_presentation_none Fixes #26809.
dgozman
Successfully merging a pull request may close this issue.
System info
Locator
Source code
Test file (self-contained)
Steps
Error: strict mode violation: getByTestId('images').getByRole('img') resolved to 2 elements
Expected
The test should only locate elements with role images.
Actual
The test incorrectly includes SVG in the located elements list.
This was working in Playwright v1.32.x.
The text was updated successfully, but these errors were encountered: